错误信息描述:
Users/xxxxx/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib Error (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) dlopen(/Library/Ruby/Gems/2.6.0/gems/bigdecimal-1.4.4/lib/bigdecimal.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/bigdecimal-1.4.4/lib/bigdecimal.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) - /Library/Ruby/Gems/2.6.0/gems/bigdecimal-1.4.4/lib/bigdecimal.bundle (LoadError)
解决方法
1.卸载HomeBrew
/bin/bash -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2.重新安装HomeBrew
官方源下载命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
国民表示下载太难,即便翻墙了也下载报错,故采用了国内源,命令如下:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
按照提示,执行完成之后,brew -v,提示 zsh: command not found:brew , 继续执行:
echo "export PATH=$PATH:/opt/homebrew/bin" >> ~/.zprofile
根据苹果官网的说法,上面
.zprofile也可以改成.bashprofile,作用一样,取决于你用的默认shell。
brew命令正常之后,执行rvm install 3.0.0,报如下错误:
根据提示,执行brew doctor正常,执行brew tap --repair继续报错,如下:
执行下面命令:
cd "$(brew --repo)/Library/Taps/"
rm -rf homebrew
mkdir homebrew
cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
至此,Homebrew正常了。
3.升级Ruby为3.0.0
rvm install 3.0.0
source ~/.rvm/scripts/rvm
rvm --default use 3.0.0
ruby -v
4.重新安装cocoapods
sudo gem install -n /usr/local/bin cocoapods