ERROR: While executing gem ... (Gem::FilePermissionError)

最近升级 cocoapods 遇到的问题,先是 gem install cocoapods 报错:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

你说没权限,那我就加上超级权限:

sudo gem install cocoapods

还是报错

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

然后我又换了一个命令:

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

还是报那个错误。


最终找到一个一发入魂的命令:

gem install cocoapods --user-install

成功!

ERROR: While executing gem ... (Gem::FilePermissionError)_第1张图片

注:如遇网络不给力,可尝试使用手机热点。

你可能感兴趣的:(iOS,工具插件相关,ios,cocoapods)