2

I'm trying to add a directory to my $PATH in mac OSX.

echo $PATH produces:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin

logged in as user and doing: vim ~/.profile shows a different set of paths and adding to it doesn't change the path echo'ed from: echo $PATH (in a new shell)

I have looked in ~/.bash_profile and its not there. I've tried looking around when logged in as sudo su - but I can't find where the above path is set for me to edit it.

echo $env shows a blank line.

Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
  • Mac OS X sets it in a TON of places take a look here: http://superuser.com/questions/69130/where-does-path-get-set-in-os-x-10-6-snow-leopard – Michael Jul 12 '13 at 06:46
  • 1
    adding into .bash_profile worked as suggested in an answer by another user which I would have accepted but it has apparently been deleted. – user2173785 Jul 12 '13 at 06:55
  • `echo $env`?? Do you have a *variable* named `env`? Perhaps you wanted to say `env`. – devnull Jul 12 '13 at 07:27

1 Answers1

0

You should add the path to .bashrc and also to source it from your .bash_profile like so

if [ -f ~/.bashrc ]; then 
    source ~/.bashrc 
fi

That way, when you set a PATH, it will apply to both.

Now when you login to your machine from a console .bashrc will be called.

KeithC
  • 436
  • 1
  • 6
  • 25