MacOS – Mac OS X Mavericks – add to path

bashmacospathterminal

I'm trying to set up a phonegap project and while trying to add a platform it outputs the following error:

Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.

I've tried what I've read here: How do I set environment variables on OS X?

and wrote the following in the .profile file:

export PATH=/users/ophir/android-sdks/tools

while it did add the android command to my path and I was able to run it and get a response, I started noticing that a simple "ls" command suddenly didn't work – until I removed what I have done.

how can I add another path to the PATH variable? how does it all work on OS X anyhow?

thanks

Best Answer

Your command replaces the entire path variable with your path, thereby removing folders such as /bin. You need to add your path to the existing path, not replace it:

export PATH=/users/ophir/android-sdks/tools:$PATH

Alternatively, so that you don't replace the tools found in folders that are in your existing path, you can add your new folder to the end of the path variable:

export PATH=$PATH:/users/ophir/android-sdks/tools