MacOS – Bash script not found El Capitan

bashcommand linemacosterminal

I have created a Bash script that simply does ls -l.

In Mavericks and older versions of OSX I simply made a symlink to the script and put it in the /usr/bin folder (ln -s /usr/bin/ll) and I could then execute the script using ll from any folder.

Since upgrading to El Capitan I am unable to load this script. I have disabled SIP so that I am able to create the symlink and the script is definitely executable. The location (/usr/bin) is definitely in the $PATH and I have even tried adding a path to the script into the $PATH too.

Nothing seems to work, all I am getting is -bash: ll: command not found.

I have restarted the terminal after each update to the $PATH and I have tried source ~/.bash_profile but neither are making any difference.

Edit: I also tried adding the current directory of the scripts to the $PATH and that was also giving the same error. In the end I have aliased all my scripts so that they will run.

Best Answer

I'm not sure what's wrong with your setup, but a different (perhaps better) way to do this same thing is via Bash's alias command. At the command prompt, type in:

alias ll="ls -l"

Then you can just type ll and get a full listing. If you wish to make this permanent, you can put it in the .bashrc file in your home directory, which you can create if it doesn't already exist.