CocoaPods not working in macOS High Sierra

After upgrading to macOS High Sierra CocoaPods is not working. While it is tempting to move away from CocoaPods, it's unfortunately not in scope right now. The error message is below.

zsh: /Users/****/.gems/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory

I realize that the error stems from Ruby being upgraded but what is the easies fix? Trying to make CocoaPods use the new ruby version yields other errors.

Edit: For now i installed Ruby 2.0 with rvm install 2.0.0 and rvm use 2.0.0 and then reinstalled CocoaPods sudo gem install cocoapods. Seems to be working now.


According to https://github.com/CocoaPods/CocoaPods/issues/6778 reinstalling CocoaPods should solve this issue:

sudo gem install cocoapods

After upgrading to macOS High Sierra, get it fixed with following commands:

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

once it will be finished then write below command:

pod install

This solution has worked for me...!!!


I got this error while installing the CocoaPods

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.

And I used this statement. It worked!

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