Am trying to reinstall cocoapods in my MacBook air after changing my SSD, now am getting this bellow error.
sudo gem install cocoapods
Building native extensions. This could take a while... ERROR: Error
installing cocoapods: ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20200308-27204-6l0a5q.rb extconf.rb mkmf.rb can't find
header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in
/Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection. Results
logged to
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out
Open Terminal
curl -L https://get.rvm.io | bash -s stable
Reopen Terminal
rvm install ruby-2.6
rvm use ruby-2.6.3
rvm --default use 2.6.3
From MahmoudKhaled's comment on
link
For me it worked by installing a previous version of cocoapods
sudo gem install cocoapods -v 1.8.4
Hope it helps
This error can be fixed by updating ruby to it's latest version version 2.3.0 is having that issue.
You can update the ruby version to latest one by following below steps.
Check the version of Ruby installed on your Mac
Open terminal and type:
ruby -v
Install the Ruby Version Manager rvm
In terminal,
curl -L https://get.rvm.io | bash -s stable
Once this command has finished running you may need to restart your terminal for rvm to be recognised.
Install the latest version of Ruby
rvm install ruby-[version]
In my case this was
rvm install ruby-2.7.1
This took a while to run as it had to install a lot of dependencies and asked for my permission a couple of times.
Set the latest version of Ruby as the one you want to use
You should now be running the latest version of Ruby. You can check as before with the ruby -v command as in step 1. If you’re find that you’re not, you can set this manually. In terminal type:
rvm use ruby-2.7.1
If you want to set this latest version of Ruby as the default version, in terminal type:
rvm --default use 2.7.1
After that done you can get your below command working for upgrading cocoapods
sudo gem install cocoapods
Probably you have not selected the Command Line Tool in Xcode > Preference > Location after an update.
The sudo gem install cocoapods command works after the tool is selected in Xcode.
Open terminal
xcode-select --install
Reopen Terminal
sudo gem install cocoapods
That's it!
Error: gem native extension error while installing cocoapods
Answer: Follow below 3 Steps issue will be fixed.
Step 1: Open XCode go to below path
XCode > Preferences > Locations > Command Line Tools (select-Xcode)
Step 2: Open Terminal- Paste the below Command
curl -L https://get.rvm.io | bash -s stable
Reopen Terminal -Paste the below Commands
Note: It will take 3-5 minutes
rvm install ruby-2.6
rvm use ruby-2.6.3
rvm --default use 2.6.3
Step3:
Open Terminal- Type below Command
sudo gem install cocoapods
Now gem native extension error while installing cocoapods will not come
Issue resolved.
I had the same error, I was unable to upgrade cocopods and the problem was that homebrew was failing to update.
I noticed that when trying to install a new ruby version with nvm, it was failing because it was trying to run homebrew update. So it seems nvm and homebrew are connected
I followed the instructions here: https://github.com/Homebrew/brew/issues/9420
basically
brew update (was failing)
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
brew update (successful)
brew install cocoapods
It didn't solve the error, but upgraded cocoapods in another way.
enter image description here
I used all the codes before and showed up there, when I tried to run flutter doctor for the millesimal time...
CocoaPods 1.8.4 out of date (1.10.0 is recommended)
I just changed to: sudo gem install cocoapods -v 1.10.0
and apparently installed the cocoapods.
brew cleanup -d -v
brew install /usr/local/bin cocoapods
Short answer:
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby
sudo gem install cocoapods
For detail pls refer: another post's answer
Related
When I run Flutter doctor:
I have tried to run sudo gem install cocoapods to install it but still the same issue.
Please not that I am running xcode 12 with the newest flutter version in the dev channel.
Any ideas?
Error after running the flutter build:
What worked for me was to uninstall Cocoapods using sudo gem uninstall cocoapods and using Homebrew instead brew install cocoapods. P.s. I'm using an M1 Macbook.
I had the same problem and after hours of looking for a solution, I solved it with these steps:
(prerequisites: install homebrew first. To check if installed, in your terminal, type $ brew -v )
$ sudo gem uninstall cocoapods (skip this part if cocoapods is not installed. command $pod --version , will tell you if it's installed or not)
$ brew install cocoapods
If there's an error 'The brew link step did not complete successfully
The formula built,........, command $ brew link --overwrite cocoapods
$ brew reinstall cocoapods
$ flutter run
My operating system is macOS Big Sur.
Are you getting an error when you tried to sudo gem install cocoapods? I had to do sudo gem install ruby first to make it work on my Mac.
In my case the problem was that there was no ruby installation on my mac after a clean install of MacOSX Catalina. So what I did, was first to install Ruby Version Manager with this command:
\curl -sSL https://get.rvm.io | bash -s stable --rails
The RVM installed Ruby on my system along with other dependencies. After that I was able to install cocoapods with the recommended command:
sudo gem install cocoapods
and it worked flawlessly for me after that. Hope this helps. It seems that Apple has removed many developer tools lately from its systems, Ruby being one of them :(
Running fastlane beta and getting this error:
Bundler::GemNotFound: Could not find CFPropertyList-3.0.0 in any of the sources
I tried installing the gem through the terminal, adding it to my gemfile, updating my fastlane version... no luck. Any ideas?
try
gem install CFPropertyList
update "You don't have write permissions for the ..."
sudo gem install CFPropertyList
I date with it error on cocoapods plugin:
I tried install CFPropetyList-3.0.0 manualy - not help, I did updates for all gems - no help.
Helped only: fastlane install_plugins command, it's updated cocoapods plugin for fastlane and now worked fine.
P.S. This error start to show after update to Mojave OS.
Update all gems:
sudo gem update --system
if this leads you to some error like:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted # rb_sysopen -
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
Try running command:
sudo gem install -n /usr/local/bin cocoapods
This will remove this error Could not find CFPropertyList-3.0.0 in any of the sources
If you get error like this with bundle install while uploading you mobile app then go inside of the android/ios folder and run command:
bundle install
The problem was with my Ruby version :
Install rvm (if you don't have it) \curl -sSL https://get.rvm.io | bash
install latest ruby (3.0.0p0) rvm install ruby#latest and set it as default rvm use ruby-3.0.0 --default
A few times install cocoapods gem install cocoapods
pod install
What does it mean and how can I fix it:
pod install
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
from /usr/local/bin/pod:22:in `<main>'
Using following commands, it worked for me.
sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin cocoapods
cocoapods pod install
If you encounter this error on step 2:
ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME)
Then try this as step 2 instead (step 3 is not needed):
gem install -n /usr/local/bin cocoapods
If you install cocoapod using brew like me
Reinstall cocoapods:
brew reinstall cocoapods
If you see this error message after you reinstall cocoapods by brew reinstall go to step 2.
>
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
rm '/usr/local/bin/pod'
To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
To list all files that would be deleted:
brew link --overwrite --dry-run cocoapods
Possible conflicting files are:
/usr/local/bin/pod
/usr/local/bin/xcodeproj
To solve conflicting files:
brew link --overwrite cocoapods
Linking /usr/local/Cellar/cocoapods/1.3.1... 2 symlinks created
Uninstall the existing cocoapods, if any, by following command:
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
Then install it to /usr/local/bin instead of /usr/bin using following command:
sudo gem install -n /usr/local/bin cocoapods
For further query, check this link to uninstall and this link to install cocoapods.
In my case nothing helped, then I:
sudo gem uninstall cocoapods
cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby; In Finder I searched for cocoapods and removed everything.
brew install cocoapods
brew link --overwrite cocoapods (if needed)
I had upgraded my ruby version 2.5.3 to 2.7.2. Then, I want to update cocoapods from 1.9.3 to 1.10.0 . I got the following error while executing pod install.
can't find gem cocoapods (>= 0.a) with executable pod
(Gem::GemNotFoundException)
There is two way to install cocoapods by using homebrew & gem. If you had install cocoapods using gem run following.
sudo gem uninstall cocoapods
sudo gem uninstall -n /usr/local/bin cocoapods
If you had used brew please using the following to uninstall
brew uninstall cocoapods
If you forgot which one you used earlier, please execute both commands. Please make sure all cocoapods instances are removed to check run pod --version.
If you find -bash: pod: command not found as output, all instances are removed properly. Else, you may need to remove cocoapods related files manually from this directory ~/.rvm/rubies/ruby-2.5.3/lib/ruby.
sudo gem update --system
gem install cocoapods
CREDIT: https://blog.csdn.net/develop_csdn/article/details/105053383
Thankfully i found solution after a hours.
As you know, newest Mac Operation System(Big Sur or oldest one) use ruby as a version system. So this ruby is private. You can not write/update some files that belong ruby.
So, we had a change to install rbenv for as a version control.
Firstly you should install rbenv via brew if you don't have
$ brew install rbenv
You need to know rbenv version number. You can see with below code snipped
$ rbenv version
Install Xcode's command line tools
xcode-select --install
Install rbenv via Homebrew
brew update
brew install rbenv ruby-build
Configure rbenv
eval "$(rbenv init -)"
Install and configure Ruby
rbenv install 3.1.1
rbenv global 3.1.1
rbenv rehash
source ~/.bash_profile
Install Cocoapods:
gem install cocoapods
In my case the reason of the issue was Gemfile file inside the folder with the project. When I removed this file, cocoapods started functioning as usual.
Try sudo gem update
After remove cocoapods
-Install cocoapods
When I tried #Aamir's solution, I ran into the error:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/specs.4.8.gz)
This worked for my Mac:
sudo gem uninstall cocoapods
sudo gem install cocoapods
What finally worked for me was running rvm reset before reinstalling cocoapods
rvm reset
rvm --version
sudo gem install -n /usr/local/bin cocoapods
from here
In my case I was not able to install pod and cocoapods using gem, after changing command line tools I was able to run the commands
Running these commands worked for me:
brew update
brew install fastlane
fastlane install_plugins
React native has made several changes and this is how you install pods now
cd ios
bundle install
bundle exec pod install
https://reactnative.dev/docs/environment-setup
This helped me after I tried all these ways
xcode-select --install
If anyone stumbles upon this as a result of updating to react native 0.67.2+ from an older version (we were on 0.66.0) you have to make sure you re-install cocoapods via gem install cocoapods. Otherwise, your pod install will not work.
I'd installed Cocoapods using gem, so I reinstalled it again using gem. nothing happened.
so I removed it and install it using brew. it works.
I have also wrote on github, so I will copy it here, maybe it will be helpful for someone.
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
To relink, run:
brew unlink cocoapods && brew link cocoapods
gem install bcrypt
Building native extensions. This could take a while...
ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.
/Users/mohit/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
creating Makefile
make clean
make
compiling bcrypt_ext.c
make: /usr/local/opt/gcc46/bin/gcc-4.6: No such file or directory
make: *** [bcrypt_ext.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/mohit/.rvm/gems/ruby-1.9.3-p547/gems/bcrypt-3.1.9 for inspection.
Results logged to /Users/mohit/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/bcrypt-3.1.9/gem_make.out
Edit with additional info from the OP:
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ brew doctor
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be
undone should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
$ brew info gcc
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require':
cannot load such file -- global (LoadError) from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:
in require' from /usr/local/Library/brew.rb:16:in `<main>'
$ gcc -v
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0 Thread model: posix
$ ls -ladg /usr/local/opt/gcc*
No such file or directory
OSX help
Try installing XCode, which tends to be a huge download:
$ xcode-select --install
If the result is anything like this message below, that's ok for now.
command line tools are already installed,
use "Software Update" to install update
Update OSX to ensure it's ok and current:
Apple Menu -> About This Mac -> Software Update
Verify you have a current system, 10.10 as of this writing:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10
BuildVersion: 14A389
Brew help
If you use the homebrew package manager, what version? (Please post output)
$ brew --version
Verify brew is healthy:
$ brew doctor
If the doctor finds any errors, fix these. For example, doctor may say to do this, so do it:
cd /usr/local/Library && git stash && git clean -d -f –
When doctor says everything is fine, then bring brew current:
$ brew update
$ brew upgrade
Is homebrew adding GCC? (Please post output)
$ brew info gcc
GCC help
Is GCC available?
$ command -v gcc
/usr/bin/gcc
See if your CC compiler variable is blank or set. (Please post the output)
$ echo $CC
What GCC version are you running? (Please post the output)
$ gcc -v
...
Apple LLVM version 6.0 (clang-600.0.34.4) (based on LLVM 3.5svn)
...
Do you have any GCC installed where Ruby is looking? (Please post the output)
$ ls -ladg /usr/local/opt/gcc*
lrwxr-xr-x 1 admin 21 Dec 18 16:41 /usr/local/opt/gcc -> ../Cellar/gcc/4.9.2_1
Root gem help
Does the gem install if you're root?
$ sudo su -
$ gem install bcrypt
The root problem here is that ruby itself comes with bcrypt version 3.1.5 which is having bugs with the newer updates. However when you install or uninstall the bcrypt you are leving behind bcrypt-ruby which it always asks for first and hence all what you are doing won't go through so what to do ? 1- uninstall bcrypt and bcrypt-ruby by running these two commands:
$ gem uninstall bcrypt
and
$ gem uninstall bcrypt-ruby
2- Install it again with
gem install bcrypt --platform=ruby
In your Gemfile write gem 'bcrypt','~>3.1.11'
NOW as i write these lines the latest version is 3.1.11 but whatever version is updated just add it from their gem page. Run bundle install and it should work just fine.
I hope you fully understand the solution and the mechanism of it hence you would know that bundle install might cause the same issue so you have to repeat this process and it'll work again.
Stuck working on an old project I was able to get the gem installed by using the following steps (check you own paths - don't just copy paste):
1) Install the specific version of gcc required (check the version) :
brew install gcc46
2) Symlink the installed gcc directory :
ln -s /usr/local/Cellar/gcc\#4.6/4.6.4_2 /usr/local/Cellar/gcc46/4.6.4
3) Install the gem reporting the error (check your gem name)
gem install bcrypt-ruby -v '3.0.1'
Before you say yum -y install ruby193... I did that.
Please note that I am not a Ruby developer, but need this program as part of another developer's work via web services. (He is not available.) Any help would be greatly appreciated.
I attempted to install a library per instructions and got:
[root#ctbroker console]# gem install json -v '1.8.0'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension. /opt/rh/ruby193/root/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /opt/rh/ruby193/root/usr/share/include/ruby.h
Gem files will remain installed in /opt/rh/ruby193/root/usr/local/share/gems/gems/json-1.8.0 for inspection.
Results logged to /opt/rh/ruby193/root/usr/local/share/gems/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
I noticed that ruby.h is only on the machine at /usr/lib64/ruby/1.8/x86_64-linux/ruby.h.
What am I missing?
I was able to to fix this problem on my system by running:
sudo yum install ruby193-ruby-devel.x86_64
RHELyum install scl-utils scl-utils-build
CENTOSyum install centos-release-SCL -y
yum install ruby193 ruby193-ruby-devel augeas-devel libxml2-devel -y
scl enable ruby193 "ruby -v"
scl enable ruby193 "bash"
gem install json -v '1.8.0'
Step 1: Run below command on your terminal:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Step 2: Install RVM Development version on your system:
\curl -sSL https://get.rvm.io | bash
For Latest version of Ruby i.e. 2.2.1 follow below steps:
\curl -sSL https://get.rvm.io | bash -s stable --ruby
After this step you should see a message like:
To start using RVM you need to run source /home/user_name/.rvm/scripts/rvm in all your open shell windows, in rare cases you need to reopen all shell windows.
Step 3: Activate ruby using the message
Source /home/user_name/.rvm/scripts/rvm
Step 4: Check Ruby version
ruby --version
Step 5: Say thanks if it works ;)
You may need to install following packages first:
yum install ruby-devel.x86_64 libxslt-devel libxml2-devel