使用sudo gem install cocoapods更新cocoapods版本时出错了,
user:~ Lib$ sudo gem install cocoapods
Fetching: ruby-macho-1.4.0.gem (100%)
Successfully installed ruby-macho-1.4.0
Fetching: fourflusher-2.2.0.gem (100%)
Successfully installed fourflusher-2.2.0
Fetching: xcodeproj-1.8.2.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
You don't have write permissions for the /usr/bin directory
报错没有/usr/bin目录的写权限。
因为二进制文件要安装在 usr/bin 这个目录下,在 OS X EI Capitan 开始,苹果就禁止了这一项操作,但是仍然可以安装在 /usr/local/bin 这个目录下来代替,并且这台机器上的用户也都可以着这个路径下访问
sudo gem install <你要安装的东西> -n/usr/local/bin
user:~ Lib$ sudo gem install cocoapods -n/usr/local/bin
Successfully installed xcodeproj-1.8.2
Fetching: cocoapods-downloader-1.2.2.gem (100%)
Successfully installed cocoapods-downloader-1.2.2
Fetching: cocoapods-core-1.6.1.gem (100%)
Successfully installed cocoapods-core-1.6.1
Fetching: cocoapods-1.6.1.gem (100%)
Successfully installed cocoapods-1.6.1
Parsing documentation for xcodeproj-1.8.2
Installing ri documentation for xcodeproj-1.8.2
Parsing documentation for cocoapods-downloader-1.2.2
Installing ri documentation for cocoapods-downloader-1.2.2
Parsing documentation for cocoapods-core-1.6.1
Installing ri documentation for cocoapods-core-1.6.1
Parsing documentation for cocoapods-1.6.1
Installing ri documentation for cocoapods-1.6.1
Done installing documentation for xcodeproj, cocoapods-downloader, cocoapods-core, cocoapods after 26 seconds
4 gems installed
更新成功
user:~ Lib$ pod --version
1.6.1
网友评论