CocoaPods not working in macOS High Sierra

这一生的挚爱 提交于 2019-12-02 14:19:56
zeisi

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
Andrew Smith

This worked for me, although I had to do

sudo gem install cocoapods

This solved my problem:

$ brew install ruby
$ gem install -n /usr/local/bin cocoapods

Simply run below command:

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

So I ran into this problem as well after having updated to High Sierra, and it seems like there's been some changes to a location of file that the ruby framework was accessing.

You can solve it using the,

sudo gem install cocoapods

and then update pods as well with for safe measures

pod repo update 

and finally

pod install

to make the pod file work again.

Hope this helps out :)

Try using

sudo gem update --system

Before

sudo gem install cocoapods

This worked for me

This works for me:

brew link --overwrite cocoapods

Go to Terminal...

step 1). sudo gem install cocoapods

after completion of install cocoa pods then

step 2). pod repo update

Completed

For me, I had to:

gem uninstall cocoapods
which pod

It still showed it in the path, so I deleted that. Made sure it still didn't show up.

Then

gem install cocoapods

I also encountered this error after installing High Sierra.

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

I used the following statement identified by Danh Huynh (see above) and It worked!

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

Cocoapods install process:

  1. sudo gem install cocoapods (if you have any problem cocoapds, please update gem file)

  2. sudo gem update --system

  3. sudo gem install cocoapods

MacOS High Sierra uses ruby 2.3 by default. After upgrading to it, some old ruby gems might not function properly. This problem occurs to me when I ran the bundle command (bundler is a ruby gem; it has a utility called bundle).

So, to clarify, any old ruby gems (cocoapods, bundler, etc) that are trying to access ruby 2.0 will fail.

The solution is to reinstall those old gems in a directory where you have permissions to write.

For cocoapods,

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

will do the trick.

You can optionally upgrade your gem system if you like before the install:

sudo gem update --system

This may prompt to you that the upgrading has failed. But actually, if you type:

gem --version

You can see that the upgrading has been successful.

For bundler or other gems, try to do the same:

sudo gem install gem-to-install(for example, bundler) -n /usr/local/bin

About the -n option. Don't miss that. You can check the gem documentation if you want.

So, the solution is all about reinstalling the old gem to a proper directory.

Had a same issue, resolution:

  1. Reinstall ruby

    brew install ruby

  2. Reinstall Cocoa Pods

    sudo gem install cocoapods

This is a common problem when upgraded to Mac OSX High Sierra.

Fix is simply installing Cocoapods (again):

sudo gem install cocoapods

Running this on terminal worked for me:

sudo gem install cocoapods

While I'm doing the same I got another error saying that

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

Then I did this and worked fine.

sudo gem uninstall cocoapods

sudo gem install cocoapods

After using the below command on the terminal, I am able to install cocoa pods in my project.

sudo gem install cocoapods --source http://rubygems.org
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!