问题一、 zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
显示找不到ruby,是shell地址改变了 变成了zsh。好嘛,重装一下。
1、重装一下 ruby:brew install ruby
Error: The following directories are not writable by your user:/usr/local/sbin
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/sbin
And make sure that your user has write permission.
chmod u+w /usr/local/sbin
执行:sudo chown -R $(whoami) /usr/local/sbin
chmod u+w /usr/local/sbin
2、检查ruby brew doctor
问题:Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
Warning: Broken symlinks were found. Remove them with `brew cleanup`: /usr/local/bin/code
执行 echo export PATH="/usr/local/sbin:$PATH"
执行 brew cleanup
3、 下载cocoapods:sudo gem install cocoapods
报错:ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (certificate rejected) (https://ruby.taobao.org/specs.4.8.gz)
因为之前是淘宝ruby,不维护了。
添加ruby-china:gem source -a https://gems.ruby-china.com
删除:gem sources --remove https://ruby.taobao.org/
查看详情:gem sources -l
4、下载:sudo gem install cocoapods
pod运行: pod setup
5、到指定路径 执行pod install
错误1:curl: (7) Failed to connect to 127.0.0.1 port 1080: Connection refused
错误2:curl: (7) Unable to receive initial SOCKS5 response.
我是因为添加了代理:export ALL_PROXY=socks5://127.0.0.1:1080
取消代理:unset ALL_PROXY
可以执行命令查看代理 env|grep -I proxy
如果没有 去vi ~/.zsh_profil 查看或者其他你写入得地址。
如果写在了~/.zsh_profil,执行命令:vi ~/.zsh_profil,删除代理
再执行命令生效: source ~/.zsh_profil
6、pod install 完成