Personal tools
You are here: Home cmgui Wiki How to set up a local bin directory
Views
How to set up a local bin directory copied.
FrontPage >> Peters notes >> Useful tips from Peter >>

How to set up a local bin directory

last edited 3 years ago by pbier

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.

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.