Personal tools
You are here: Home / cmgui / Wiki / How to set up a local bin directory
Log in

Forgot your password?

How to set up a local bin directory

This page outlines a quick method I sometimes use for allowing executables (binaries and scripts) I install locally to be run from any directory.

One possible method is to edit your shell startup scripts (eg .bashrc) and add the directory containing the executable(s) into your PATH environment variable each time you want to add new executable(s). Sometimes it can be a pain to update your PATH variable though, especially if it is for only one executable.

Another possible method is as follows:

  1. Set up a local bin directory:

    cd ~/
    mkdir bin
  2. Add your bin directory to your path. Edit your .bashrc file (or equivalent) to add in ~/bin to your path. If you are running a bash script then you would add a line like: 'export PATH=~/bin:.:$PATH'. Remember to either start a new shell or source your .bashrc file to reload it: 'source ~/.bashrc'

  3. Either copy executables into this bin directory or create a symbolic link from within your user bin directory to the executable you want to use, eg:

    cd ~/bin
    ln -s $~/path/to/script/bob bob

Using symbolic links is a good idea, especially if the executable may be updated via source control or a build. Creating one symbolic link is usually less effort than playing with your PATH variable.