This is the short version:
When I run
pod install
in an Xcode project I get
[!] Pod::Executable pull error: cannot open .git/FETCH_HEAD: Permission denied
If I run
sudo pod install
I get no error, but my files installed are owned by root and can't compile and I have to chown
those files to a normal user to use the Xcode compiler.
I am running Lion OSX.
I installed cocoaPods using
sudo gem install cocoaPods
I had to use sudo
because without it I got
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
so now I have a root installed version of cocoaPods that downloads root owned Xcode libraries.
Is sudo
installation of cocoaPods the wrong way or normal way?
If normal, is there a way to fix the pod install problem?
I would suggest you install CocoaPods using brew . It's a little cleaner option and you can update it easier. The cocoapods cask is for CocoaPads App and the formula is for the CLI only version. Save this answer.
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.
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