Monthly Archives: October 2008

Adding an environment variable to Bash PATH in OS X

I can never remember how to add environment variables to .bash_profile. This post just reminds me how to do that.

It’s dead simple. Just open up Terminal and enter the following (changing the path ‘/opt/subversion/bin’, naturally):

echo 'export PATH=/opt/subversion/bin:$PATH' >> ~/.bash_profile

If .bash_profile doesn’t exist yet (and it doesn’t by default), it’ll be created. Otherwise, the environment variable will be added to that file.

Credit to Indy Nagpal.