3kk9gg
Last Updated: February 25, 2016
·
976
· prudnikov

User's bin directory OS X way

You may want to have you custom executable scripts. Usually they goes to the ~/bin, but personally I don't like a lot of folders in my home directory, at least visible folders. Here is how I do it.

In OS X you can make any folder hidden. I assume you already have ~/bin. Now we will make it hidden by running the following command in Terminal

chflags hidden ~/bin

Now you should modify you ~/.profile file. Add the following lines at top of it.

# Include user's bin folder.
if [ -d "$HOME/bin" ] ; then
    export PATH="$HOME/bin:$PATH"
fi

and save it. Now execute

source ~/.profile

to apply these changes. That's it. You can create any script inside this folder. Make sure these files have executable flag. To make it executable run the following command:

chmod +x ~/bin/your_script.sh

Happy coding!

Say Thanks
Respond