orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 93 forks source link

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

Closed RJ-Clegg closed 5 years ago

RJ-Clegg commented 5 years ago

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:

However nothing seems to work.

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

Thanks!

shadow-boy commented 5 years ago

same issue

RJ-Clegg commented 5 years ago

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

ashfurrow commented 5 years ago

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

RJ-Clegg commented 5 years ago

@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 commented 5 years ago

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

fishercraigj commented 4 years ago

@RJ-Clegg - Props brother. thanks.

chinarut commented 3 years ago

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

Vheesaa commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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

vizllx commented 3 years ago

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
  1. After completing Step 2 , run the following
  1. Install cocoapods from scratch

    • sudo gem install -n /usr/local/bin cocoapods
    • pod setup
  2. 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 commented 3 years ago

gem install cocoapods-keys

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

aheze commented 2 years ago

@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 commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

https://github.com/orta/cocoapods-keys/issues/217#issuecomment-1304420876 fixed my issue.

MhMudSalAh commented 1 year ago

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 commented 1 year ago

Upgrading to cocoapods-keys 2.3.1 solved my issue, previous versions seemed to have problems with M1 chips. Check out here: https://github.com/orta/cocoapods-keys/pull/235