Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)"

I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.

When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.

± sudo pod install ruby-1.9.3-p0 Password: /Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help) CocoaPods, the Objective-C library package manager. Commands:.... 

Any suggestion to overcome the issue would be very helpful. Thanks in advance.

2

5 Answers

I had to update permission on CocoaPods

sudo chown -R $USER ~/Library/Caches/CocoaPods

sudo chown -R $USER ~/.cocoapods

Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.

sudo chown -R $USER ./Pods

I have removed the old podfile.lock before running pod install

Source :

cocoaPods pod install Permission denied

0

I am working with windows. After reading all tips which didn't work I drove into the code base. As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.

In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.

#help! 'You cannot run CocoaPods as root.' if Process.uid == 0 

Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.

In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.

Nothing worked for me except the following

  1. switched to ios platform with cd platforms/ios
  2. switched ownership of the folder to the current user with sudo chown -R YourUsername .
  3. Pod install

in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like