Mac解决EROR: While executing gem ... (Gem::FilePermissionError) You don‘t have write permissions f

sudo gem install -n /usr/local/bin cocoapods
在执行上述命令报错如下

Mac解决EROR: While executing gem ... (Gem::FilePermissionError) You don‘t have write permissions f_第1张图片

解决方案:

截图中报错信息提示权限不够,是因为我们电脑上自带的ruby,一般不要自行删除系统自带的ruby,可以再安装一个

brew install [email protected]

arch -arm64 brew install [email protected](如果上一个命令报错Base64之类的错误,就执行这个)

// 设置环境变量

echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

// 保存上述设置

source ~/.zshrc

// 再次尝试安装cocoapods

sudo gem install -n /usr/local/bin cocoapods

最终成功安装

Mac解决EROR: While executing gem ... (Gem::FilePermissionError) You don‘t have write permissions f_第2张图片

你可能感兴趣的:(react,native,cocoapods,ruby)