13

I cannot get my .bash_profile aliases to work on my Mac OSX Terminal. I created a .bash_profile file in my ~/ directory, then wrote two lines:

echo bash profile has loaded

alias prof=“open ~/.bash_profile”

I saved and entered in Terminal command:

. ~/.bash_profile

Terminal displayed:

bash profile has loaded

-bash: alias: /Users/kennethlarose/.bash_profile”: not found

I've been reading up on alias profiles, and I believe my syntax is valid. I know the profile is sourcing because it displays the echo, but Terminal will show the same 'not found' message no matter what command I save in the alias. Does anybody know what else I can try?

chepner
  • 497,756
  • 71
  • 530
  • 681
Matt LaRose
  • 133
  • 1
  • 1
  • 4
  • I just got this same error but it seems to have been because the command I wanted to alias was too long. When I tried the same format with a much shorter command it worked fine. So if you're trying to fun a very long command (not this case but a head's up for other readers), you should drop the command in a file and make the file executable like so http://stackoverflow.com/questions/817060/creating-executable-files-in-linux – Sunnyside Productions Jan 09 '15 at 15:28

1 Answers1

32

Let's ask shellcheck!

In .bash_profile line 2:
alias prof=“open ~/.bash_profile”
           ^-- SC1015: This is a unicode double quote. Delete and retype it.

There's your problem. OS X has turned your double quotes into fancy slanted quotes that bash doesn't recognize. If you're programming, you may want to disable "smart quotes".

that other guy
  • 116,971
  • 11
  • 170
  • 194