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

5,907 阅读1分钟

最近在使用pod install命令时一直报错:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.

错误信息显示权限不够,好吧,修改权限

sudo gem install cocoapods --pre
sudo chmod 777 /Library/Ruby/Gems/2.3.0

试试证明以上命令均无效: 最后使用一下命令安装成功

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

然后

pod install

成功执行

Analyzing dependencies
Downloading dependencies
Installing SDWebImage (4.3.3)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `MainProject.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.