Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
826 views
in Technique[技术] by (71.8m points)

rubygems - cocoaPods pod install Permission denied

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...