Hi there, you might have started reading this article because you were trying to install cocoapods for the first time in your Mac system or installing pods after updating the Podfile for your Xcode project. But the issue is that it is not allowing you to install the package and keeps on giving you EPERM error, isn’t it?
Don’t worry you have come to the right article that could help you to solve the issue and let you move further in your project development process. Here I have discussed a few different scenarios from which you have to find out which is best suitable for you.
As you can see from above image that I tried to install pods after updating the podfile but it doesn’t allow me because the pods installed on my system already are not up to date. So I tried to update the pods by specifying the version that I want in the command itself but it still gave me the EPERM error. The same error could happen if you try to install packages like Cocoapods into your Mac system that has a newer MAC OS version like El Captain.
The solution is also mentioned in the above image. It is very simple and just one parameter in the command that you use to install cocoapods in your system. The command should as below to install cocoapods or update them. By providing the bin directory path of your system resolves the issue and gem gets installed without any issues.
sudo gem install cocoapods -n /usr/local/bin
It could be various reason that by default the gem install command gets failed to identify default bin directory of your system. You might have changed the bin directory path for recent package installation or anything else but it definitely allows you to install cocoapods using the above comment for sure.
The standard way to install pods into your system is to follow below commands and you must be able to install them without any problem.
$ sudo gem install cocoapods [...] 1 gem installed $ export PATH=$PATH:/Library/Ruby/bin $ pod --version 0.37.2
There is one more solution that if you are getting “Operation Not Permitted” error. Just follow the commands stated below. This method is only if you want to update the GEM_HOME directory for just installation and add it to your system PATH variable
$ mkdir -p $HOME/Software/ruby $ export GEM_HOME=$HOME/Software/ruby $ gem install cocoapods [...] 1 gem installed $ export PATH=$PATH:$HOME/Software/ruby/bin $ pod --version 0.37.2
Someone has explained why we should specify the bin directory path in the install command. It is here if you would like to read it through. If you find any problems while installing the pods, feel free to reach out to us through the comment section below. We would be glad to help you.
Thank you & Stay Techie…