I am trying to run a pod install command from the Xcode cocoapods plugin.  
When I run the update/install cocoapods command I get an error:
/usr/bin/gem install cocoapods
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
It is strange as if I go to the directory in terminal and run a pod install I have no issues.  
What is to note is that the error refers to Ruby 2.0.0, whilst when I run a ruby -v command from the directory in terminal I get (ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.4.0])
EDIT - as requested:
ls -la /Library/Ruby/Gems  
total 0  
drwxr-xr-x  4 root  wheel  136 27 Oct 23:39 .  
drwxr-xr-x  4 root  wheel  136 27 Oct 23:36 ..  
drwxr-xr-x  6 root  wheel  204 25 Aug 02:44 1.8  
drwxr-xr-x  2 root  wheel   68 25 Aug 04:13 2.0.0  
                This specific to Mavericks were the default Ruby has been upgraded to 2.0.0 and you have previously used CocoaPods with a previous version of Ruby. The workaround is to run the gem install cocoapods commands as root, but not as the logged in user with sudo. 
From Terminal, run sudo -s to enter a shell as the root user. Then run gem install cocoapods. Now you can run Run Update/Install from the CocoaPods plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With