View Full Version : Windows PATH equivalent in MAC OS X

12-03-2008, 07:12 AM

I usually use "rar" and "unrar" app from terminal. But every time I need to run the app in a folder, first I copy the rar app to that folder and then use ./rar to run the app.

Where can I put the rar and unrar app so I can run it from any folder that I need?


12-03-2008, 07:36 AM
In your PATH:

echo $PATH

12-03-2008, 07:39 AM
tks! I put rar and unrar app in /usr/bin and set mod to 775, now it's working. Things are easy when you know what to do... :)

12-03-2008, 09:26 AM
You could also create your own folder and add that path to your PATH environment variable. This would probably be a better idea as /usr/bin is owned by the system and software updates could potentially overwrite, alter, or remove any custom additions.

Also, instead of copying the binary to your current directory, you could replace ./ with the full path to the rar / unrar apps.

12-03-2008, 10:48 AM
I agree with fracai--you shouldn't put your own command-line apps in /usr/bin, they are in danger of being overwritten at any time by a system update. As /usr/bin is owned by the operating system, not you, it's a dangerous place to put stuff.

The "correct" Unix place to put your own command line apps is /usr/local/bin. Move rar and unrar to that location for safety, then add /usr/local/bin to your PATH (preferably earlier in the PATH than /usr/bin). And any future command-line apps that you add to your computer--put them in the same directory. That way, you can easily check and update just the apps that you've added.