Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Macos Catalina error after update: unable to run colorls

Updating to macOS Catalina gives error on opening terminal

ERROR:  Can't find Ruby library file or shared library colorls
usage: dirname path
/Users/varunsukheja/.zshrc:source:91: no such file or directory: /tab_complete.sh

When I checked for the .zshrc file for line 91, I found below line

source $(dirname $(gem which colorls))/tab_complete.sh

And on checking gem which colorls I got below error

ERROR:  Can't find Ruby library file or shared library colorls

But when I check which colorls I get below path

/usr/local/bin/colorls

Also I tried installing colorls again using gem

Building native extensions. This could take a while...
ERROR:  Error installing colorls:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/ext/clocale
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20191009-43313-16ndnb.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/clocale-0.0.4/gem_make.out

Please help how to make it work.

like image 884
Varun Sukheja Avatar asked Oct 09 '19 12:10

Varun Sukheja


2 Answers

Here is how I solved it:

  1. sudo xcode-select --install
  2. Install rbenv with brew install rbenv
  3. Add eval "$(rbenv init -)" to the end of ~/.zshrc or ~/.bash_profile
  4. Install a ruby version rbenv install 2.6.0
  5. Select a ruby version by rbenv rbenv global 2.6.0
  6. Open a new terminal window.
  7. Verify that the right gem folder is being used with gem env home (this should report something in your user folder, not system wide).

After this I installed colorls again using sudo gem install colorls

If getting error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

Try installing colorls using cmd:

sudo gem install colorls -n /usr/local/bin

After this you see colorls is installed successfully and new terminal works fine.

like image 59
Varun Sukheja Avatar answered Dec 27 '22 08:12

Varun Sukheja


This worked for me:

xcode-select --install sudo gem install colorls -n /usr/local/bin

like image 32
Josean Avatar answered Dec 27 '22 08:12

Josean