报错信息
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
一、安装openSSL
1、执行以下命令安装
brew install openssl@1.1
2、设置openSSL环境变量
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
source ~/.zshrc
3、查看openSSL安装路径
which openssl
// 路径
/opt/homebrew/opt/openssl@1.1/bin/openssl
二、重新安装ruby
执行以下命令安装
rvm reinstall 3.1.2 --with-openssl-dir='openssl安装路径'
sudo gem install -n /usr/local/bin cocoapods
网友评论