I was installing some tools on my mac today which I wanted to have in the path. Specifically I was installing the Android-SDK tools. I wanted to have the adb shell come up no matter which directory I was in. Being a Linux guy I check out /etc/profile but discovered that mac does it just a tiny bit different . Below I will show you two ways to edit your path in mac OSX. One is permanent and one only lasts until reboot.
The First Way:
The same as in Linux you can just edit the $PATH from the command line. This will last only for your session and will not survive a reboot.
- export PATH=$PATH:/new_path_entry
I was looking for a more permanent solution so I had to dig a little deeper into how mac does things.
The Second Way:
It seems mac actual has a path file. It is located in /etc/path
- Infidel:~ purehate$ sudo vi /etc/paths
The file just has each directory path on a individual line so add what ever you need. In my example I added /Users/purehate/Documents/android-sdk/tools which is where my adb tools are.
This method will be permanent and add the directory to your path each time you boot.