Mac10.13 Pod报错-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
升级10.13以后Pod命令失效,解决办法如下:
终端执行下列命令
1.brew link --overwrite cocoapods
尝试 Pod 命令是否已经恢复 ,若报错继续执行
2.brew install ruby
3.brew reinstall cocoapods
4.brew link --overwrite cocoapods
尝试 Pod 命令是否已经恢复
二、弄完之后如果报错
/usr/local/bin/pod: /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/pod: line 2: /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod: Undefined error: 0
可以参考下面两个文章,我也对两篇文章有需要的地方做了总结,所以也可以继续看我的文章第三步骤
文章一/
文章二/WainYan
三、更新gem
1.查看gem版本号
gem -v
2.查看ruby源。
gem sources -l
3.替换ruby源(如果是https://gems.ruby-china.com, 则跳过3、4步)
gem sources --remove https://gems.ruby-china.org
gem sources --add https://gems.ruby-china.com
注意是https://gems.ruby-china.com 不是https://gems.ruby-china.org.
4.确保ruby源是https://gems.ruby-china.com
gem sources -l
5.更新gem版本
gem update --system
如果错误:
>ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
使用:sudo gem update --system
6.打印gem版本号 是否成功
gem -v
如果更新完报错如下:那么就要像我一样参考 这篇“时苒君”的文章了,总结为一句话,看步骤四
mayonggang@bogon digital_city_IAP % pod update --no-repo-update --verbose
Traceback (most recent call last):
5: from /usr/local/bin/pod:23:in `<main>'
4: from /usr/local/bin/pod:23:in `load'
3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.7.5/bin/pod:55:in `<top (required)>'
2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:49:in `run'
1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
下图:
报错如此图.png
四、
需要到 Git 官网下载 Git 才可以:
https://git-scm.com/download/mac
image WechatIMG15.jpeg第一次进入这里是一个倒计时,倒计时结束自动下载
下载完成后手动安装 git 这样就可以解决了 !
网友评论