自己的英特尔芯片的Mac很久没有用,最近拿出来升级了系统和Xcode之后,运行pod提示版本太低,更新pod之后报错(提示更新pod需要安装openssl库)
安装openssl库
默认执行brew install openssl,安装的是openssl@3,我试了发现得用openssl@1.1才行
使用openssl@3升级ruby报错如下
halodeMacBook-Pro:~ halo$ rvm install 2.7
Warning! PATH is not properly set up, /Users/halo/.rvm/gems/ruby-2.4.1/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.4.1
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
ruby-2.7.2 - #removing src/ruby-2.7.2..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/12.6/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Missing required packages: autoconf automake libtool pkg-config coreutils libyaml libksba readline zlib openssl@1.1
Somehow it happened there is no executable 'openssl',
run 'brew doctor' and make sure latest 'openssl@1.1' is installed properly.
Requirements installation successful.
Installing Ruby from source to: /Users/halo/.rvm/rubies/ruby-2.7.2, this may take a while depending on your cpu(s)...
ruby-2.7.2 - #downloading ruby-2.7.2, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.0M 100 14.0M 0 0 49360 0 0:04:57 0:04:57 --:--:-- 59398
ruby-2.7.2 - #extracting ruby-2.7.2 to /Users/halo/.rvm/src/ruby-2.7.2.....
ruby-2.7.2 - #configuring......................................................-
ruby-2.7.2 - #post-configuration.
ruby-2.7.2 - #compiling........................................................-
Error running '__rvm_make -j4',
please read /Users/halo/.rvm/log/1673763438_ruby-2.7.2/make.log
There has been an error while running make. Halting the installation.
Error running '__rvm_make -j4' 这个错误太坑了,找了一堆资料,搞了好久,踩了很多坑,在这过程中我还重装了cocoapods、Homebrew、RVM、Ruby
Mac OS 10.14 运行“__rvm_make -j4”时出错 ·问题 #4484 ·RVM/RVM (github.com)
Error running '__rvm_make -j4' - Ruby 2.5.0 on macOS 10.13.2 · Issue #4271 · rvm/rvm (github.com)
rvm 安装 3.0.0 显示运行“__rvm_make -j4”时出错,在 BigSur ·问题 #5059 ·RVM/RVM (github.com)
只好删除openssl@3,brew uninstall openssl@3
安装brew install openssl@1.1,然后升级Ruby
升级Ruby
rvm install 2.7.2 --with-openssl-dir=`brew --prefix openssl@1.1`
完整的解决方案记录如下
这是我在这个过程中,最后成功的解决路径
sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools.old
xcode-select --install
安装完成之后,执行
sudo rm -rf /Library/Developer/CommandLineTools.old
rvm get stable
rvm reload
brew install openssl@1.1
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
rvm install 2.7.2 --with-openssl-dir=`brew --prefix openssl@1.1`
附上找资料的时候,M系列芯片的Mac这个问题的解决方案
- Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
- Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
- Reinstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Restart terminal
- Check Homebrew is working fine:
brew doctor - Reinstall openssl:
brew install openssl - Install Ruby: Or any version
rvm install 2.7