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

吾心所向發表於2018-04-08

最近在使用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.
複製程式碼

相關文章