Where should I store command line applications?

Since OS X comes from a unix heritage, you will want to store system files in /usr/local/bin for command line applications and scripts that belong to the system locally and not to a specific user. You may need to create this directory first by running:

sudo mkdir -p /usr/local/bin

You can move any command line application to that folder by running:

sudo mv my-binary /usr/local/bin/

To make sure that /usr/local/bin is part of your standard search path in Terminal, check the content of /etc/paths and add it if necessary:

grep -w /usr/local/bin /etc/paths || sudo sh -c 'echo /usr/local/bin >> /etc/paths'

Some users make a second directory for user level scripts, but this is even more subject to personal preference.

I typically make a bin directory in each user folder and then hide it from Finder - but you can make that decision yourself whether you want it hidden:

 mkdir ~/bin
 chflags hidden ~/bin

In this case, you'll want to have each user's path include this location by modifying the shell startup scripts (~/.bash_profile for bash which is the standard shell)

 export PATH=$PATH:~/bin

or by hard coding the path to each app when you run it.


Consider creating an /opt directory, which is another location that custom Unix software would appear by convention.