« 15.07.07 | Main | 26.07.07 »

20.07.07

sad mac icon© 1995-2003 Apple

How to add a folder permanently to the PATH variable of your Mac OS X environment:

echo 'export PATH=/your/path/:$PATH' >> ~/.bash_profile

Notes:

  • /your/path/ for instance could be /usr/local/bin/
  • the config file for the standard terminal in OS X is not .bashrc
  • sometimes .bashrc contains instructions although not used, you may want to keep these by using mv ~/.bashrc ~/.bash_profile
  • make sure you use the apostrophe and not quotation marks, because "$PATH" would replace $PATH with the actual content of the path variable
  • the >> is used to append the output of the preceding command to the file, thus preserving the contents of the file
  • to check what your current bash profile looks like, use cat ~/.bash_profile

Update: I forgot to mention, but you can similarly export any environment variable permanently, for instance:

echo 'export SVN_EDITOR=VIM' >> ~/.bash_profile