>运行此bash脚本以删除所有相关的宝石:
for i in $( gem list --local --no-version | grep cocoapods ); do sudo gem uninstall $i; done
>删除〜/ .cocoapods删除podspecs的缓存:
rm -rf ~/.cocoapods/
>更新rubygem:
sudo gem update --system
>重新安装cocoapods:
sudo gem install cocoapods
Step3 error message:@H_301_22@ …@H_301_22@ …@H_301_22@ Done installing documentation for rubygems-update after 0 seconds@H_301_22@ Installing RubyGems 2.7.1@H_301_22@ ERROR: While executing gem … (Errno::EPERM)@H_301_22@ Operation not permitted @ rb_sysopen –@H_301_22@ /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
Step4 error message:@H_301_22@ Fetching: cocoapods-core-1.3.1.gem (100%)@H_301_22@ Successfully installed cocoapods-core-1.3.1@H_301_22@ Fetching: cocoapods-deintegrate-1.0.1.gem (100%)@H_301_22@ Successfully installed cocoapods-deintegrate-1.0.1@H_301_22@ Fetching: cocoapods-downloader-1.1.3.gem (100%)@H_301_22@ Successfully installed cocoapods-downloader-1.1.3@H_301_22@ Fetching: cocoapods-plugins-1.0.0.gem (100%)@H_301_22@ Successfully installed cocoapods-plugins-1.0.0@H_301_22@ Fetching: cocoapods-search-1.0.0.gem (100%)@H_301_22@ Successfully installed cocoapods-search-1.0.0@H_301_22@ Fetching: cocoapods-stats-1.0.0.gem (100%)@H_301_22@ Successfully installed cocoapods-stats-1.0.0@H_301_22@ Fetching: cocoapods-trunk-1.3.0.gem (100%)@H_301_22@ Successfully installed cocoapods-trunk-1.3.0@H_301_22@ Fetching: cocoapods-try-1.1.0.gem (100%)@H_301_22@ Successfully installed cocoapods-try-1.1.0@H_301_22@ ERROR: While executing gem … (Gem::FilePermissionError)@H_301_22@ You don’t have write permissions for the /usr/bin directory.
我对Linux / OSX文件系统的了解有限,不知道出了什么问题.
以下是有关我的电脑的信息:
> OS:
macOS High Sierra 10.13.1@H_301_22@> Xcode:
版本9.0.1(9A1004)@H_301_22@我还在应用程序文件夹中将XCode 7.3.1重命名为Xcode_7@H_301_22@>环境路径:
echo $PATH
/Library/Frameworks/Python.framework/Versions/3.4/bin:@H_301_22@在/usr/local / bin目录:@H_301_22@在/usr/bin中:@H_301_22@/斌:@H_301_22@/usr/sbin目录:@H_301_22@/ sbin目录:@H_301_22@/选择/ X11 / bin中:@H_301_22@/Applications/Server.app/Contents/ServerRoot/usr/bin:@H_301_22@/Applications/Server.app/Contents/ServerRoot/usr/sbin@H_301_22@>自制软件:
brew --version
自制1.3.6@H_301_22@Homebrew / homebrew-core(git revision 985b; last commit 2017-11-07)
brew list
cmake libxml2忍者pkg-config readline wget@H_301_22@gdbm libyaml openssl python3 sqlite xz@H_301_22@> RubyGems:
gem --version
2.7.1
gem list
*本地宝石*@H_301_22@activesupport(5.1.4,4.2.10)@H_301_22@bigdecimal(1.3.2,默认值:1.2.8)@H_301_22@CFPropertyList(2.3.5,2.2.8)@H_301_22@claide(1.0.2)@H_301_22@有色2(3.1.2)@H_301_22@并发ruby(1.0.5)@H_301_22@did_you_mean(1.0.0)@H_301_22@逃跑(0.0.4)@H_301_22@fourflusher(2.0.1)@H_301_22@fuzzy_match(2.1.0,2.0.4)@H_301_22@gh_inspector(1.0.3)@H_301_22@i18n(0.9.1)@H_301_22@io-console(0.4.6,默认值:0.4.5)@H_301_22@json(2.1.0,默认值:1.8.3)@H_301_22@libxml-ruby(3.0.0,2.9.0)@H_301_22@mini_portile2(2.3.0)@H_301_22@minitest(5.10.3)@H_301_22@molinillo(0.6.4,0.5.7)@H_301_22@纳奈莫(0.2.3)@H_301_22@午睡(1.1.0)@H_301_22@net-telnet(0.1.1)@H_301_22@netrc(0.11.0)@H_301_22@nokogiri(1.5.6)@H_301_22@power_assert(1.1.1)@H_301_22@psych(2.2.4,默认值:2.1.0)@H_301_22@耙子(12.2.1,10.4.2)@H_301_22@rdoc(5.1.0,默认值:4.2.1)@H_301_22@ruby-macho(1.1.0)@H_301_22@rubygems-update(2.7.1)@H_301_22@sqlite3(1.3.11)@H_301_22@测试单元(3.2.6)@H_301_22@thread_safe(0.3.6)@H_301_22@tzinfo(1.2.4)@H_301_22@xcodeproj(1.5.3)
解决方法
还从运行sudo gem update –system获得了Ruby重新安装错误
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
然后我尝试再次执行相同的命令(sudo gem update –system)并且已经安装了最新版本.完成.
而不是跑步
sudo gem install cocoapods
尝试
sudo gem install -n /usr/local/bin cocoapods
最终为我工作!没有像你在第1步中所做的那样使用bash-script清理以前的cocoapods,但是在重新安装时不应该有所作为.