2

I am running MAC OS X.

I added a new alias to my .profile. Now, when I open a terminal window, I get a message saying that the alias cannot be found. Do I have to do some sort of exporting to get the change to my .profile to take affect?

As requested, my .profile.

export PATH=$PATH:/opt/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib

alias sl='ls'
alias pwd='echo -n `pwd` | pbcopy'
well actually
  • 11,810
  • 19
  • 52
  • 70

3 Answers3

1

You need to source your profile:

source .profile

Reed Olsen
  • 9,099
  • 4
  • 37
  • 47
0

If you're running leopard or snow leopard then you should put the alias into .bash_login, not .profile.

That's if you're using bash of course, which Mac OS X does by default I believe.

Jerry Saravia
  • 3,737
  • 3
  • 24
  • 39
  • Maybe it has something to do with the back ticks there. Where is the .profile file? I can't find mine. I had never used it and putting one in my home directory didn't work. – Jerry Saravia Apr 01 '11 at 05:56
0

Have you checked that you are using bash (or ksh) which reads .profile and not tcsh (the default shell on MacOS X) which does not read .profile?

Do any other commands in your profile get executed?


The alias not working is:

alias pwd='echo -n `pwd` | pbcopy'

The issue there is: what command is executed when the

`pwd`

is executed -- oops; it's the alias? Try:

alias pwd='echo -n $(/bin/pwd) | pbcopy'

We could also argue that you can use just:

alias pwd='/bin/pwd | pbcopy'
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278