If youâre starting out with a fresh install of OS X (10.9 in my example) and are using any development tools, at some point Iâm sure youâll want to add some directories to your system PATH. In short: this allows you to use an application in a specific directory from any other directory â commonly when youâre running commands in Terminal.
To start, weâll utilize a text editor â in my case Iâm using TextMate â but any plain text editor should do. Letâs get to it:
Letâs first make sure you donât already have a .bash_profile. In TextMate, go to File > Open. Browse to your home folder (with the house icon) and click âShow Hidden Filesâ. In your home folder you shouldnât already see a .bash_profile file. (If you do, then you donât need to create a new file and can open your file, make changes and skip to step 5.)
So cancel the open dialog and enter some text into the untitled file currently open. Youâre usually entering something like: export PATH=${PATH}:/somedirectory/asubdirectory:/anotherdirectory
Now letâs save our new .bash_profile. Go to File > Save As. Browse to your home folder (with the little house icon again). Enter the filename as â.bash_profileâ (without quotes).
If you get a message saying ânames that begin with a dot are reserved for the systemâ chose âUse â.ââ
Thatâs it. Now if you already have a terminal open run source ~/.bash_profile (this just give you access to the updated PATH).