cocoaPods pod install Permission denied
I solved this problem by running the following command:
sudo chown -R $USER ~/Library/Caches/CocoaPods
and
sudo chown -R $USER ~/.cocoapods
Please replace username
and groupname
with your Mac login username/groupname.
I only used (where username
is your Mac login username)
sudo chown -R username ~/Library/Caches/CocoaPods
and
sudo chown -R username ~/.cocoapods
when I tried with the groupname parameter I got
chown: username.groupname: illegal user name
Of course I used my own username and groupname :)
The issue is with Mac OS X's default installation of Ruby. The Ruby/Gems installation is owned by root in the location you specified.
This is normal behavior unless you install a Ruby manager. I would recommend rbenv but RVM is popular as well.
These installed your Ruby installation in your $HOME
folder. This way your user owns the Ruby and gem executables.
Removing the directories worked for me:
sudo rm -R ~/Library/Caches/CocoaPods
sudo rm -R ~/.cocoapods/repos
If some other problems still exist.
Remove the Pods directory and the podFile.lock file.
Cocoapods just adds the directories again.