Nov 5, 2012

Adding the home directory's bin subfolder to the MacOS terminal

This is a pure reminder to myself to remember this the next time I stumble upon this issue (source is: google it :-) )

Since I sometimes write shell scripts for automating tasks and want them to be usable without the complete path-typing, I put them in my ~/bin directory. But for some reason, my MacOS 10.8 didn't find the scripts residing there, because my PATH-variable for /bin/bash obviously lacked the standard user directory.

To change that, simply open a terminal and edit .bash_profile e.g by
nano .bash_profile
and add the following line to that file:
export PATH=~/bin:$PATH
After that, Control+X and answer yes, then simply quit and open again the terminal, and it will find all the scripts residing in your ~/bin which are executable (if they are not, chmod u+x yourscriptname can fix that easily) whereever you call the name of the script.

No comments: