Macos Catalina error after update: unable to run colorls

China☆狼群 提交于 2021-01-21 03:53:45

问题


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.


回答1:


This worked for me:

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




回答2:


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.




回答3:


This fixed for me:

$ sudo gem update
$ sudo gem install colorls

Catalina now ships with Ruby 2.6, instead of 2.3. My guess is that with the upgrade, all custom installed gems became "untracked" by the new Ruby/Gem package system. With that, gem update doesn't take care of updating colorls.

Make sure you reinstall XCode command line tools, update/upgrade brew, npm and others.




回答4:


What solved it for me was to:

  1. Open Xcode
  2. Click on the Xcode tab at top left corner
  3. Open preferences
  4. Click on Locations Tab
  5. Select Command Line Tools

For some reason, there were no command line tools selected, so this caused issues for me. I downloaded a beta version of Xcode, and none were selected when I updated to the latest version.




回答5:


Error: gem native extension error while installing cocoapods

Answer: Follow below 3 Steps issue will be fixed.

Step 1: Open XCode go to below path

XCode > Preferences > Locations > Command Line Tools (select-Xcode)

Step 2: Open Terminal- Paste the below Command

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

Reopen Terminal -Paste the below Commands

Note: It will take 3-5 minutes

rvm install ruby-2.6

rvm use ruby-2.6.3

rvm --default use 2.6.3

Step3:

Open Terminal- Type below Command

sudo gem install cocoapods

Now gem native extension error while installing cocoapods will not come

Issue resolved.



来源:https://stackoverflow.com/questions/58303940/macos-catalina-error-after-update-unable-to-run-colorls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!