原文 http://blog.csdn.net/sing_sing/article/details/49762359


该方法好用

sudo gem install -n /usr/local/bin cocoa pods


此方法我试着不好用

重新安装: 
sudo gem install cocoa pods

出错
ERROR: While executing gem ... (Errno::EPERM) 
Operation not permitted - /usr/bin/xcodeproj

解决办法,是要将gem的默认路径重新修改: 
$ mkdir -p $HOME/Software/ruby 
$ export GEM_HOME=$HOME/Software/ruby 
$ gem install cocoapods 
[...] 
1 gem installed 
$ export PATH=$PATH:$HOME/Software/ruby/bin

验证一下,安装成功: 
$ pod --version 
0.39.0

05-11 22:34