Macos – zsh returns bad interpreter after Catalina upgrade

macos catalinaruby

I am getting an error message after upgrading to macOS Catalina.

zsh: /usr/local/bin/colorls: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

It seems Ruby has been updated since, when I run ruby -v, it outputs the following.

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

How can I make colorls use Ruby 2.6 instead of Ruby 2.3 that was present when the command was installed?

I tried reinstalling and then uninstalling it multiple times, but I am still getting the same error.

I did manage to temporarily make the error message disappear using the following line.

PATH="`ruby -e 'puts Gem.user_dir'`/bin:$PATH"

Every time I open a new terminal, the error message comes again. I will like to find a way to make it persistent.

Best Answer

After couple of different solutions I tried I managed to make it work with RVM.

Install rvm from terminal:

\curl -sSL https://get.rvm.io | bash -s stable

Once installation is complete, it will say something like:

To start using RVM you need to run `source /Users/{username}/.rvm/scripts/rvm`

So copy/paste that into terminal, and then install ruby version you want, I used:

rvm install 2.6.5

Now when you have your ruby in place you should be able to install gems for the version you've chosen, eg I installed bundler

gem install bundler

This will make rvm as default ruby manager, and will use 2.6.5 from terminal. Hope that helps.

Related Question