本文介绍了Macos Catalina更新后出现错误:无法运行colorls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
更新到macOS Catalina 会导致打开终端错误
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
当我检查第91行的.zshrc文件时,我发现在行以下
When I checked for the .zshrc file for line 91, I found below line
source $(dirname $(gem which colorls))/tab_complete.sh
然后在检查 gel的颜色
时,我遇到了以下错误
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
我也尝试使用gem再次安装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
请帮助如何使其工作.
推荐答案
这是我解决的方法:
-
sudo xcode-select --install
- 使用
brew install rbenv
安装rbenv - 在
〜/.zshrc
或〜/.bash_profile
- 安装ruby版本
rbenv install 2.6.0
- 通过rbenv选择一个红宝石版本
rbenv global 2.6.0
- 打开一个新的终端窗口.
- 验证正确的gem文件夹是否与
gem env home
一起使用(这应该报告用户文件夹中的内容,而不是系统范围内的内容).
sudo xcode-select --install
- Install rbenv with
brew install rbenv
- Add
eval "$(rbenv init -)"
to the end of~/.zshrc
or~/.bash_profile
- Install a ruby version
rbenv install 2.6.0
- Select a ruby version by rbenv
rbenv global 2.6.0
- Open a new terminal window.
- Verify that the right gem folder is being used with
gem env home
(this should report something in your user folder, not system wide).
此后,我再次使用 sudo gem install colorls
如果出现错误:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
尝试使用cmd安装colorls:
Try installing colorls using cmd:
sudo gem install colorls -n /usr/local/bin
此后,您将看到成功安装了colorls并且新终端可以正常工作.
After this you see colorls is installed successfully and new terminal works fine.
这篇关于Macos Catalina更新后出现错误:无法运行colorls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!