Adding Your Own Tools to the PATH

tux-toolboxOK, so you’ve got some useful tools you’ve written (or simply forked from How best to make them useable from the Terminal? One way or another, you’ve got to get them into the PATH. If you have sudo privileges and the tool has a installation script (or an install target in its Makefile), you can install it system wide. If there is no install script but you have sudo privileges, you may be able to hack it into /usr/local/bin. But what if you don’t have sudo privileges?

First, you have control over your own PATH, the environment variable that controls the directories that will be searched for commands by the shell. To override the default PATH, edit the file ~/.bashrc. If you aren’t using bash as your shell (why?), look up the documentation of your shell to figure out how to set its PATH.

OK, but you probably don’t want to do this every time you add a new tool. If the tool supports begin run via a symbolic link or can be easily copied, I suggest creating your own personal ~/bin directory:

mkdir ~/bin

Next, edit ~/.bashrc and search for a line that begins with export PATH=. If found, replace “PATH=path” with “PATH=~/bin:path“. Otherwise, add the line:

export PATH=~/bin:${PATH}

Restart the terminal or run “source ~/.bashrc”, and you will be able to run any tools that you copy or symbolically link to ~/bin.


Not all tools take kindly to being run via a symbolic link or via a copy of the tool. You may need to link or copy additional files or directories (libraries or data files) to your bin directory to get a tool to work. Compiled programs that use dynamically linked libraries (AKA .so files) may require those files be added to the LD_LIBRARY_PATH. If so, you can create a ~/lib directory and add it to the LD_LIBRARY_PATH, just like you added ~/bin to PATH.


About jimbelton

I'm a software developer, and a writer of both fiction and non-fiction, and I blog about movies, books, and philosophy. My interest in religious philosophy and the search for the truth inspires much of my writing.
This entry was posted in systems administration, tools and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s