Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods commands fail due to "No such file or directory @ dir_initialize - /Users/<username>/.cocoapods/repos (Errno::ENOENT)"

Tags:

cocoapods

If the message says you are missing a lib:

I got same problem and it was fixed after running pod setup and then pod install

If the missing directory is the ruby dir you can do:

You have probably updated your osx or ruby gem recently and its PATH is still linking to the old ruby version. Fix with:

sudo gem install -n /usr/local/bin ruby

sudo gem install -n /usr/local/bin cocoapods

As said by @rendel


Cocoapods had an issue where their github repository had become corrupted, and this forces users to clean up their local repo manually.

A quote from the Cocoapods blog post detailing the error:

Unfortunately we've encountered a bug in libgit2 and we are going to have to force push into the Specs repository. (Also known as the ‘master’ spec repo.)

What does this mean for you? Well, basically your CocoaPods setup is going to break. You are going to have to manually delete any local copies of the Specs repository and re-clone the new version of the Specs repository. You can do that with the following commands:

The Solution:

$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup

Simply running the commands above will remove the corrupted repo and reinitialize using a clean repo. See the blogpost mentioned above for more information.

Hope this helps!


I had similar issue. I deleted Pods folder and run pod install again. Problem solved.


Nothing worked for me, I had to sudo gem install cocoapods and that did the magic.


Tried a ton of stuff and the only fix for me was saying

brew install cocoapods

and then

brew link --overwrite cocoapods

Now it seems to be working fine.