最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]sudo gem install cocoapods出错:ERROR While executing gem Errno EPERM Operation not permitted /usr/bin/xcodeproj

iOS crifan 897浏览 0评论

折腾:

[已解决]gem install cocoapods出错:ERROR Could not find a valid gem cocoapods >= 0

期间,用:

sudo gem install cocoapods

去安装时,结果出错:

licrifandeMacBook-Pro:inquzhou crifan$ sudo gem install cocoapods
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: claide-0.9.1.gem (100%)
Successfully installed claide-0.9.1
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)Fetching: tzinfo-1.2.2.gem
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.8.4.gem (100%)
Successfully installed minitest-5.8.4
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.6.gem (100%)
Successfully installed activesupport-4.2.6
Fetching: xcodeproj-0.28.2.gem (100%)
ERROR:  While executing gem … (Errno::EPERM)
    Operation not permitted – /usr/bin/xcodeproj

[解决过程]

1.去把源换成速度更快的淘宝的:

先去更新一下源:

licrifandeMacBook-Pro:inquzhou crifan$ gem sources –add https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources
licrifandeMacBook-Pro:inquzhou crifan$ gem sources –remove http://rubygems.org/
http://rubygems.org/ removed from sources
licrifandeMacBook-Pro:inquzhou crifan$ gem sources -l
*** CURRENT SOURCES ***
licrifandeMacBook-Pro:inquzhou crifan$

结果问题依旧。

2.搜:

ERROR  While executing gem Errno EPERM Operation not permitted /usr/bin/xcodeproj

安装Cocoapods, 更新gem出现的问题。 – SegmentFault

OS X 10.11 安装Cocoapods 出现问题的解决方法 – NSNirvana的博客 – 博客频道 – CSDN.NET

cocoapods – Cocoa Pods not updating pods on El Capitan – Stack Overflow

OS X 10.11上安装CocoaPods – 简书

CocoaPods Guides – Getting Started

去试试:

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

结果就可以了:

licrifandeMacBook-Pro:inquzhou crifan$ sudo gem install -n /usr/local/bin cocoapods
Password:
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.39.0.gem (100%)
Successfully installed cocoapods-core-0.39.0
Successfully installed xcodeproj-0.28.2
Fetching: cocoapods-downloader-0.9.3.gem (100%)
Successfully installed cocoapods-downloader-0.9.3
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-search-0.1.0.gem (100%)
Successfully installed cocoapods-search-0.1.0
Fetching: cocoapods-stats-0.6.2.gem (100%)
Successfully installed cocoapods-stats-0.6.2
Fetching: cocoapods-try-0.5.1.gem (100%)
Successfully installed cocoapods-try-0.5.1
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.6.4.gem (100%)
Successfully installed cocoapods-trunk-0.6.4
Fetching: molinillo-0.4.5.gem (100%)
Successfully installed molinillo-0.4.5
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-0.39.0.gem (100%)
Successfully installed cocoapods-0.39.0
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.39.0
Installing ri documentation for cocoapods-core-0.39.0
Parsing documentation for xcodeproj-0.28.2
Installing ri documentation for xcodeproj-0.28.2
Parsing documentation for cocoapods-downloader-0.9.3
Installing ri documentation for cocoapods-downloader-0.9.3
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-search-0.1.0
Installing ri documentation for cocoapods-search-0.1.0
Parsing documentation for cocoapods-stats-0.6.2
Installing ri documentation for cocoapods-stats-0.6.2
Parsing documentation for cocoapods-try-0.5.1
Installing ri documentation for cocoapods-try-0.5.1
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.6.4
Installing ri documentation for cocoapods-trunk-0.6.4
Parsing documentation for molinillo-0.4.5
Installing ri documentation for molinillo-0.4.5
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.39.0
Installing ri documentation for cocoapods-0.39.0
14 gems installed
licrifandeMacBook-Pro:inquzhou crifan$

[总结]

由于Mac中,即使是sudo的权限,都不允许直接操作写入/usr/bin

所以为了正常能安装cocoapods,则把安装路径设置为:

/usr/local/bin

(而不是默认的/usr/bin)

用:

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

去安装,就可以正常安装了。

转载请注明:在路上 » [已解决]sudo gem install cocoapods出错:ERROR While executing gem Errno EPERM Operation not permitted /usr/bin/xcodeproj

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
59 queries in 0.254 seconds, using 18.89MB memory