9

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  
StuartM
  • 6,743
  • 18
  • 84
  • 160

2 Answers2

12

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.

neilco
  • 7,964
  • 2
  • 36
  • 41
0

Ok, this was a permission error to the suggested path:

I run the following:

sudo chown -R `whoami` "/Library/Ruby/Gems/2.0.0/"

Then had another error pointing to /usr/bin, so run:

sudo chown -R `whoami` "/usr/bin"
StuartM
  • 6,743
  • 18
  • 84
  • 160