MacOS – ‘ls’ command not working on mac OS Catalina

bashcommand linemacosterminal

Ever since updating my mac to OS Catalina I have noticed quite a few changes were made to the terminal.

Upon opening the terminal there is always the entry:

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

I've noticed that when using ls, instead of listing the items within the current directory, it activated ghostscript. In a flurry of frustration I uninstalled ghostscript using the opensource script from https://gist.github.com/gwerbin/dcba755b0484423e9e45.

Now when I run ls, I get the following output:

GPL Ghostscript 9.16: Can't find initialization file gs_init.ps.

How do I repair things, so that I can get ls or at least have a new command dir that lists the directory?

Best Answer

If you do not want to change your shell from bash to zsh, then add this to your .bashrc file:

export BASH_SILENCE_DEPRECATION_WARNING=1

To edit this you can use this command:

nano ~/.bashrc 

While you are editing your .bashrc file, look for aliases or functions which redefined ls use Ghostscript.

Try which -a ls in Terminal.app to show you what ls is currently defined as, and what other ls commands are available.