Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cocoapods-keys doesn't work after upgrading to macOS Catalina #198

Closed
RJ-Clegg opened this issue Jun 19, 2019 · 19 comments
Closed

Cocoapods-keys doesn't work after upgrading to macOS Catalina #198

RJ-Clegg opened this issue Jun 19, 2019 · 19 comments

Comments

@RJ-Clegg
Copy link

I realise using beta software means these sort of issues will come up and generally unsupported; however I am hoping someone can assist me? (maybe its something simple 👍 )

My issue is almost identical to #143

My output is as follows:

---------------------------------------------
Error loading the plugin `cocoapods-keys-2.1.0`.

SystemExit - ERROR: Can't find header dir for ruby. Exiting...
/Users/robert/.gems/gems/RubyInline-3.12.4/lib/inline.rb:564:in `abort'
/Users/robert/.gems/gems/RubyInline-3.12.4/lib/inline.rb:564:in `build'
/Users/robert/.gems/gems/RubyInline-3.12.4/lib/inline.rb:856:in `inline'
/Users/robert/.gems/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:17:in `<class:OSXKeychain>'
/Users/robert/.gems/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:6:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/robert/.gem/ruby/2.6.0/gems/cocoapods-keys-2.1.0/lib/keyring.rb:1:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/robert/.gem/ruby/2.6.0/gems/cocoapods-keys-2.1.0/lib/cocoapods_plugin.rb:1:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:94:in `block in safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:94:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:94:in `safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:31:in `block in load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:30:in `map'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command/plugin_manager.rb:30:in `load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:326:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:325:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:325:in `run'
/Users/robert/.gems/gems/cocoapods-1.7.2/lib/cocoapods/command.rb:52:in `run'
/Users/robert/.gems/gems/cocoapods-1.7.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
---------------------------------------------

[!] Your Podfile requires that the plugin `cocoapods-keys` be installed. Please install it and try installation again.

I have tried:

  • gem install cocoapods-keys --user-install
  • Upgrading and reinstalling Ruby (On version 2.6.3)
  • Sudo gem install cocoapods-keys`

However nothing seems to work.

I would really appreciate it if someone can point me in the right direction!

Thanks!

@shadow-boy
Copy link


same issue

@RJ-Clegg
Copy link
Author

I eventually solved this issue. It was to do with the local Ruby version.

@ashfurrow
Copy link
Collaborator

@RJ-Clegg glad you got it working! Can you describe the steps you took to fix it?

@RJ-Clegg
Copy link
Author

@ashfurrow - Sorry, I should have elaborated on how I fixed this. :)

I did the following in terminal:

  1. brew install rbenv ruby-build
  2. Opened my ~/.zshrc (Or bash if you're using that)
  3. Paste in if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi at the end of the file.
  4. Save and close the file
  5. Once the brew install (step 1) is done: $ source ~/.zshrc

Then ran the following commands:

  1. rbenv install 2.6.3
  2. rbenv global 2.6.3
  3. ruby -v - to check it updated

Now most importantly do:

which gem
If it doesnt report /Users/<youruser>/.rbenv/shims/gem then restart your terminal.

If all goes to plan next run
gem install cocoapods-keys

Remember not to use sudo on the gem install.

Now run pod install - and it should go through without errors.

@ashfurrow
Copy link
Collaborator

@RJ-Clegg no worries – that's fantastic detail, thank you! I bet that it'll help other developers too 👍

@fishercraigj
Copy link

@RJ-Clegg - Props brother. thanks.

@chinarut
Copy link

chinarut commented Sep 2, 2020

@RJ-Clegg thanks for teaching me about rbenv - that worked fantastic 👍

@Vheesaa
Copy link

Vheesaa commented Nov 18, 2020

@RJ-Clegg - this was so helpful! I was stuck running "sudo gem install cocoapods" and it did not work. I found your step by step process, only change is once I ran gem install cocoapods-keys, I couldn't run "pod install", I had to run "sudo gem install cocoapods" and now flutter doctor shows 0 issues!

@KoKoNotChanel
Copy link

@ashfurrow - Sorry, I should have elaborated on how I fixed this. :)

I did the following in terminal:

  1. brew install rbenv ruby-build
  2. Opened my ~/.zshrc (Or bash if you're using that)
  3. Paste in if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi at the end of the file.
  4. Save and close the file
  5. Once the brew install (step 1) is done: $ source ~/.zshrc

Then ran the following commands:

  1. rbenv install 2.6.3
  2. rbenv global 2.6.3
  3. ruby -v - to check it updated

Now most importantly do:

which gem
If it doesnt report /Users/<youruser>/.rbenv/shims/gem then restart your terminal.

If all goes to plan next run
gem install cocoapods-keys

Remember not to use sudo on the gem install.

Now run pod install - and it should go through without errors.

thank u man, i've spend 30 minutes for this problem and u helped me

@ALeonidou2005
Copy link

ALeonidou2005 commented Dec 11, 2020

Very helpful!!!!! Thanks a lot, saved lots of time!👌👍

NOTE FOR MacOS Big Sur Users:
In order for the above to work, you need to have the LATEST version of XCode. (In my Case 12.2)

@Maks-Sa
Copy link

Maks-Sa commented Feb 5, 2021

@RJ-Clegg
Thank you! it's very helpful!

@vizllx
Copy link

vizllx commented Apr 28, 2021

I really appreciate the way @RJ-Clegg explained in a detailed way to fix the issue of cocoapods-keys.

But for those who have failed to get the value of path as mentioned here, even after restarting terminal:-

which gem
If it doesnt report /Users/<youruser>/.rbenv/shims/gem then restart your terminal.

Solution

Do the following -

Pre-Steps
A. gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall -> remove all existing cocoapod installation
B. sudo gem uninstall -aIx -> remove the existing gem installation from local mac

Now, follow as mentioned in the above by @RJ-Clegg , with some custom steps:-

  1. brew install rbenv ruby-build
  2. In terminal do the following steps
  • touch ~/.zshrc --> To make sure file is created
  • open ~/.zshrc --> Open the file
  • add the following line if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi at the end of file.
  • Save and close the file.
  • source ~/.zshrc -> to add it in the shell
  1. After completing Step 2 , run the following
  • rbenv install 2.6.3
  • rbenv global 2.6.3
  • ruby -v --> to check it's updated
  • which gem
    It will surely show /Users/<youruser>/.rbenv/shims/gem
  1. Install cocoapods from scratch
  • sudo gem install -n /usr/local/bin cocoapods
  • pod setup
  1. Final step install cocoapod-key
  • gem install cocoapods-keys

That's it, now cocoapods-key will not show error in case of pod install or update 🥳

@anandat
Copy link

anandat commented Jun 15, 2021

gem install cocoapods-keys

in case you dont have have permission
try this
export GEM_HOME="$HOME/.gem"

@aheze
Copy link

aheze commented Jan 3, 2022

@RJ-Clegg thanks! rbenv global 2.6.3 was the key for me. In my case I did rbenv global 3.1.0 since that was the ruby version that I installed.

@Yesigomwe
Copy link

I have tried all the suggested solutions above and non of them seemed to work for me.

However, what worked for me was;

  1. Open Podfile in project and delete the cocoapod-keys then save and close the podfile.
  2. Remove cocoapods by running command gem uninstall cocoapods.
  3. Run command sudo gem update.
  4. Run command gem install cocoapods.
  5. Run pod install

With the steps above, pods were able to install successfully. This is on precondition that you are sure to be having ruby installed already which you can check by running the command which ruby. If you don't have it already, you can install it on your mac through homebrew .

@skoricmilan
Copy link

skoricmilan commented Oct 19, 2022

To be honest none of those solutions worked for me, just typing randomly commands will not help.
I don't know why, but my path was misconfigured. So first you should check if the path is good. I have used brew and installed rbenv in order to use safely libraries and after I ran pod install, I saw it was not targeting the right folder and always used the system version.

After I ran command "gem env" I saw that some paths are not correct.
"INSTALLATION DIRECTORY, RUBY EXECUTABLE, EXECUTABLE DIRECTORY, SYSTEM CONFIGURATION DIRECTORY AND GEM PATH"
should start something like this(depends of version) /Users/{username}/.rbenv/versions/3.1.2/lib/ruby/. ... otherwise it uses system version..
In order to fix this you need to set paths in ~/.zshrc and ~/.zprofile

my zshrc looks like this:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH=/opt/homebrew/bin:$PATH
export RBENV_ROOT=$HOME/.rbenv
export PATH=$RBENV_ROOT/shims:/versions:$PATH

zprofile:
eval $(/opt/homebrew/bin/brew shellenv)

in order to change /.zshrc: type nano ~/.zshrc

@sawalon
Copy link

sawalon commented Nov 5, 2022

#217 (comment)
fixed my issue.

@MhMudSalAh
Copy link

Your Podfile requires that the plugin cocoapods-keys be installed. Please install it and try installation again.

I have this error in M1 MAX & Monterey 12.6.1 & Xcode 14.1 & ruby version 3.1.2

I couldn't solve this problem with all possible solutions
and I did all steps in this Article
and setup "gem install cocoapods-keys" and I have the same error, however I have ruby version 3.1.2
Can anyone solve this problem ?!!

@jakernodle
Copy link

Upgrading to cocoapods-keys 2.3.1 solved my issue, previous versions seemed to have problems with M1 chips. Check out here: #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests