Closed RJ-Clegg closed 5 years ago
same issue
I eventually solved this issue. It was to do with the local Ruby version.
@RJ-Clegg glad you got it working! Can you describe the steps you took to fix it?
@ashfurrow - Sorry, I should have elaborated on how I fixed this. :)
I did the following in terminal:
brew install rbenv ruby-build
~/.zshrc
(Or bash if you're using that) if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
at the end of the file. $ source ~/.zshrc
Then ran the following commands:
rbenv install 2.6.3
rbenv global 2.6.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.
@RJ-Clegg no worries – that's fantastic detail, thank you! I bet that it'll help other developers too 👍
@RJ-Clegg - Props brother. thanks.
@RJ-Clegg thanks for teaching me about rbenv - that worked fantastic 👍
@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!
@ashfurrow - Sorry, I should have elaborated on how I fixed this. :)
I did the following in terminal:
brew install rbenv ruby-build
- Opened my
~/.zshrc
(Or bash if you're using that)- Paste in
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
at the end of the file.- Save and close the file
- Once the brew install (step 1) is done:
$ source ~/.zshrc
Then ran the following commands:
rbenv install 2.6.3
rbenv global 2.6.3
ruby -v
- to check it updatedNow 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
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)
@RJ-Clegg Thank you! it's very helpful!
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.
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:-
brew install rbenv ruby-build
touch ~/.zshrc
--> To make sure file is createdopen ~/.zshrc
--> Open the file if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
at the end of file.source ~/.zshrc
-> to add it in the shellrbenv install 2.6.3
rbenv global 2.6.3
ruby -v
--> to check it's updatedwhich gem
It will surely show /Users/<youruser>/.rbenv/shims/gem
Install cocoapods from scratch
sudo gem install -n /usr/local/bin cocoapods
pod setup
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 🥳
gem install cocoapods-keys
in case you dont have have permission try this export GEM_HOME="$HOME/.gem"
@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.
I have tried all the suggested solutions above and non of them seemed to work for me.
However, what worked for me was;
gem uninstall cocoapods
.sudo gem update
.gem install cocoapods
.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 .
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
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 ?!!
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
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:
I have tried:
gem install cocoapods-keys --user-install
However nothing seems to work.
I would really appreciate it if someone can point me in the right direction!
Thanks!