How To Add a Directory To PATH

Adding an executable file to your global include path is a must when you plan on installing any applications through a manual download. Often you may have errors when commands that once worked are now returning the following error.

appname --version
-bash: appname: command not found

This error might not be caused by the lack of an application, it could simply be due to the fact that the location of the applications files or executable has not been added to the PATH file. If you want to check your path file simply type the following into your terminal.


This will show you the contents of your path file. If your applications install path is not in this directory then this is likely the cause of your command not working. Adding a new entry to the path file is very simple. One thing to make sure of is to rename any executable to remove the extension from the end. Ie. “file.phar” => “file”.

The purpose of $PATH is to save the current contents of the PATH file ie. concatenating the contents of the file with the new entry.

export PATH=$PATH:/path/to/dir

Sometimes you may need to use quotes if there is an error.

export PATH="$PATH:/path/to/dir"

Now you should be able to run commands regardless of your current working directory.

appname --version
appname version 1.1