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?

1
  • 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 stackoverflow.com/questions/817060/… Commented Jan 9, 2015 at 15:28

1 Answer 1

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".

Sign up to request clarification or add additional context in comments.

3 Comments

Gee! That link helped me resolve the automatic spell check feature that was bugging the crap out of me. +1 for that.
Genius answer, why hasn't this been marked up to over 1000 already? Cheers
Thank you for this! I was racking my brain trying to figure out why a dead-simple alias wouldn't work properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.