I updated my Mac OS and try to use "pod install" for my .xcworkspace. However I get below error:
"Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2"
Could you please recommend how to overcome this issue?
Two suggestions:
Make sure you have the latest pod installed, pod --version should be 1.10.0 (or later).
Do pod install --repo-update.
Related
I'm just learning to use cocoapods and am encountering an error when trying to install a pod.
Top of error:
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001045b8000
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
Bottom of error:
zsh: abort pod install
Have tried the following, as suggested on some threads here and GitHub:
Uninstalling and re-installing cocoapod
sudo gem install xcodeproj
sudo gem update
but nothing seems to be working; the error persists and the .xcworkspace file doesn't appear.
Any help would be much appreciated. Thank you!
If the other solution (sudo arch -x86_64 gem install ffi) does not work for you, try the following one instead:
gem install --user-install ffi -- --enable-libffi-alloc
After that, run pod install or whatever you were trying to do again, but without prefixing it with arch -x86_64.
It worked for me without issues and this way I could also avoid going the Intel emulation (Rosetta 2) way.
I find this solution in an issue filed on the ffi github project.
I came across someone having this issue a while ago and I believe one of the suggestions made was to try the following:
install gem using
sudo arch -x86_64 gem install ffi
and then run this
arch -x86_64 pod install
it might work, it might not, I'm not too sure.
This is because from the arm64 part of your error message I assume you have an M1 Mac. Either way it's probably worth a try.
Reinstalling CocoaPods with brew and removing ffi gem solved the issue for me.
sudo gem uninstall cocoapods
sudo gem uninstall ffi
brew install cocoapods
pod install
When I installed cocoa pods I got this message. The cocoa pods downloaded is in version 1.10.1. Ive tried to use the command they give but this appears:
Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
Does it means that the latest version available is 1.13.1 but I can't use it because of a problem? How to solve it?
This solved the issue for me
brew install cocoapods
should already be linked (as pointed out by Raphael Pinel) but if you want to make sure run
brew link --overwrite cocoapods
Basically, you need to do what the warning message says: install the Gem "ffi" in the specified version by running gem pristine ffi --version 1.13.1. However, usually you don't have write permissions on the system to install a Gem into the stated directory.
You could probably just use sudo, i.e. run the command sudo gem pristine ffi --version 1.13.1 and enter the password, but I guess this is generally not recommended as it is a security risk.
I installed it like this:
gem install ffi --version 1.13.1 --user-install
Then I had to add the installation path to my PATH variable; in my case I added this line to my ~/.zshrc:
export PATH=$HOME/.gem/ruby/2.6.0/bin:$PATH
I'm really not an expert on Ruby stuff, but this solved the issue for me.
This worked for me :
sudo gem pristine ffi (don't write a version here, because it will fix the problem of all versions)
then :
pod install
MacOS: Ventura v13.0
Updating the Ruby version worked like a charm. Did the following steps.
$ brew install rbenv
Installed the latest ruby version.
$ rbenv install 3.1.2
To activate the above version as global default version.
$rbenv global 3.1.2
To install ffi
$ sudo gem install ffi --version 1.15.5 --user-install
in my case ( mbpm1 pro ) , my other project are fine , but some project from my friend ( windows only) i got some issue , i fixed by
arch -x86_64 sudo gem install ffi
flutter clean dont forget to clean after installing some gem
flutter pub get re get
run now ( these run would automatically run pod install ) just click on main.dart ( vscode )
None of the answers worked for me. So, I thought of uninstalling all versions of ruby which I had unknowingly installed, and keeping only the one installed by Xcode.
brew uninstall --force ruby
Then, uninstalled cocoapods
brew uninstall --force cocoapods
I was left with the ruby installed by XCode. I ran:
gem pristine ffi --version 1.15.3
I realised the other versions got installed in ~/.local
I deleted the whole folder as it had nothing other than the old gem folder
rm -rf ~/.local
Now, reinstall cocoapods:
brew install cocoapods
Try running:
pod install
OR
gem -v
You should not see this error.
This usually happens when you have multiple gem versions installed and the path is incorrect.
P.S I am using macOS Monterey 12.1
My issue was that the pre installed ruby had those extensions installed and caused the error messages. Run the command below to
see all installed packages. Said command should also print the error Ignoring ... because its extensions are not built. Directly reference /usr/bin/gem since you might have ruby installed via brew which would be called otherwise.
/usr/bin/gem list
Then manually uninstall all mentioned extensions for the default ruby.
sudo /usr/bin/gem uninstall ffi
In my case I had paths mismatch, this command helped me:
rvm get stable --auto-dotfiles
Also check paths order in you .zshrc file
f.e.
# Ruby
export PATH="~/.rvm/gems/ruby-2.6.0/bin:$PATH"
export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
# User local
export PATH="/usr/local/bin:$PATH"
gem install cocoapods
This is a workaround and not a solution, but for me, after trying all other posted solutions (on Monterey 13.0.1, I traced it back to it seemingly picking the homebrew installed cocoapods picking up the ffi library from ~/.rbenv/shims, with the only timely work around being to install cocoapods via gem, per above.
All this said, I don't claim to be well versed in rbenv, or any other dependency manager, for that matter.
I'd love to know a better answer that didn't bork the homebrew based installation.
Start the Terminal on a Mac M1 with Rosetta and run
pod update
Background
A few years ago I installed cocoapods for a project I was working on. Since then I have not used it and now I need to update it to get Flutter working.
System
OS MacOS Mojave
Version 10.14.3
Question
I do not want to end up installing 2 different versions of cocoapods and cause myself a bunch of problems. I am trying to determine how I originally installed cocoapods so I can update it.
How can I determine how cocoapods was originally installed?
What I Tried
I can see cocoapods is installed because when I run,
pod --version the output is
1.3.1
When I run which cocoapods I get
cocoapods not found
When I run which pod I get
/usr/local/bin/pod
I checked that file and it is a cocoapods file installed by a ruby gem. This is what I see when I look at the file,
!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
#
This file was generated by RubyGems.
#
The application 'cocoapods' is installed as part of a gem, and
this file is here to facilitate running it.
At this point I try and update it,
gem update cocoapods
I get,
Updating installed gems Nothing to update
When I run gem list I get a list of installed gems but pods nor cocoapods is in the list.
I also checked brew list and do not see it installed in there either. I can see evidence that it was installed as a gem but I do not understand why gem update cocoapods finds nothing to update.
Update
I broke down and went ahead and tried to install cocoapods as a gem since I already had the gem file in place.
gem install cocoapods
When I run gem list it shows that cocoapods was installed as version 1.6.1 as there are a bunch of new cocoapods files in my gem list.
When I run pod --version it still says 1.3.1.
I removed the pod file from /usr/local/bin and then ran pod --version again. At this point I get a command not found error.
After adding it back I can see the same output of the old version exists again. 1.3.1.
I tried removing the old pod file from /usr/local/bin and then gem install cocoapods. After doing so the pod command will not work but I can see that cocoapods is installed as a gem on my system.
Evidently there is a problem installing cocoapods on some newer MacOS systems due to the all of the permissions changes rolled out from Apple.
I saw a suggestion to install cocoapods on El Captain like this,
sudo gem install -n /usr/local/bin cocoapods
Which would explain why I have a rogue pod file inside of that directory.
Solution
I deleted the pod file out of my /usr/local/bin folder.
I installed cocoapods again using => sudo gem install -n /usr/local/bin cocoapods
Now when I run pod --version I get 1.6.1.
I had some problems with one version of the project. I've found this answer where someone suggest steps to remove all cocoapods-connected stuff from the machine and reinstall it. I did follow the steps:
$ 'pod --version'
0.36.1
$ gem list --local | grep cocoapods
cocoapods (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-core (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-downloader (0.9.3, 0.9.1)
cocoapods-plugins (0.4.2)
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2, 0.5.3)
cocoapods-trunk (0.6.4, 0.6.1)
cocoapods-try (0.5.1, 0.4.5)
$ gem uninstall cocoapods // and all others from the list above
The problem is that when i again grep all cocoapods, the list was equal to upper one, nothing disappeared.
$ sudo gem uninstall cocoapods
Select gem to uninstall:
1. cocoapods-0.37.2
2. cocoapods-0.38.1
3. cocoapods-0.38.2
4. cocoapods-0.39.0.rc.1
5. All versions
> 5
$ pod --version
// here was the error command not found, so everything fine
$ sudo gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
Successfully installed cocoapods-0.38.2
Parsing documentation for cocoapods-0.38.2
Installing ri documentation for cocoapods-0.38.2
Done installing documentation for cocoapods after 2 seconds
1 gem installed
$ pod --version
Could not find proper version of cocoapods (0.36.1) in any of the sources
Run `bundle install` to install missing gems.
But why does it want me to install 0.36.1? Anyway, as it asked, I did:
$bundle install
Installing cocoapods-core 0.36.1
Installing cocoapods-downloader 0.8.1
Installing cocoapods-plugins 0.4.1
Installing cocoapods-trunk 0.6.0
Installing cocoapods-try 0.4.3
Installing cocoapods 0.36.1
// Many "using" dependencies
So now when I run:
$ pod --version
0.36.1
And I'm stuck :) Why can't I have newest release version? Maybe pod --version points to the newest version of cocoapods-core instead of only cocoapods, so everything is ok and I have the correct version?
Check if you use Gemfile and there is specified the version of
cocoapods.
You can use specific version by pod *version* action. For example: pod _1.5.0.beta.1_ update or pod _1.5.0.beta.1_ install
For anyone coming to this in an attempt to update cocoapods. After doing all of the above I wasn't able to get this resolved. I then headed to the resolved answer and being unwilling to remove RVM, I tried to resolve this issue another way.
I found that my issue did indeed lie in my Gemfile.
First, run
gem install cocoapods to ensure you have the latest version, or whatever specified version you were looking for downloaded.
Second, ensure your projects Gemfile hasn't specified a cocoapods version number and instead simply specifies it as:
gem "cocoapods"
If yours doesn't, change this and run bundle update to regenerate the Gemfile.lock file and your problem should be solved. If not, go ahead and delete the Gemfile.lock file altogether and then run bundle update. You can easily check to see which gem version will be loaded by opening the Gemfile.lock file and searching for cocoapods-core <version number here>
At this point, you can go into your project and run
pod setup
and then check the cocoapods version with
pod --version
and now FINALLY you are free to run
pod install
to replace the Podfile.lock file and get back to your happy dev life. Hope that helps someone and saves them from burning hours.
It seems something got messed up in my ruby version. I still have no idea what and why. I've managed to fix it via this solution: https://stackoverflow.com/a/25021772/849616. After it everything works correctly.
You might face this issue when it comes migrating to a higher Swift version. Assuming that you already have cocoapods installed, you probably need to run bundle update command (possibly with sudo).
For more details, you could check: https://guides.cocoapods.org/using/a-gemfile.html
Additionally, I'd suggest to do the following:
Install the latest Xcode version.
Clear derived data (not just clean project) in your project.
Run pod update command.
I have the same problem.
In my project, pod --version and gem which cocoapods always return diffrence version.
All I had to do is remove Gemfile.lock in my project and bundle install again. It removed the locked cocoapods version and install a new one.
Hope that helps some one here.
I ran pod install and I've got this error:
Could not find proper version of cocoapods (1.11.3) in any of the sources
and I ran:
bundle install
after that pod install worked properly
After installing cocoapods with sudo gem install cocoapods, attempting to run pod setup returns this error:
Could not find 'cocoapods' (>= 0) among 64 total gem(s) (Gem::LoadError)
Output from sudo gem install cocoapods:
CHANGELOG:
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
• [CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0)
• [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader/compare/0.2.0...0.3.0)
[ bug/enhancement notes removed for brevity]
Successfully installed cocoapods-0.29.0
Parsing documentation for cocoapods-0.29.0
1 gem installed
When I list the gems installed, I do not see cocoapods listed among my Local Gems but I do see 'pod' listed in /usr/local/Cellar/ruby/2.0.0-p0/bin.
System Configuration:
Mac OS 10.9 (upgraded from 10.8)
Xcode: 5.0.2 (upgrade from 4.x)
Ruby path: /usr/local/Cellar/ruby/2.0.0-p0
How can I get cocopods to work for me?
Uninstalling and reinstalling CocoaPods from the Terminal fixed the issue for me (see the CocoaPods documentation for more information):
gem uninstall cocoapods
gem install cocoapods
For me it was
sudo gem install cocoapods
Try:
sudo pod setup
Since you installed cocoapods as supervisor (sudo), there are files that supervisor can see that you can not.
This also means that after you add a pod to a podFile, you'll also need to run
sudo pod install
instead of
pod install
It ultimately might be better to undo the sudo install of cocoa pods and use RVM.
With RVM you can have different versions of gem sets (including different versions of cocoapods, if required). By going this route, you can then bypass having to run pod commands as sudo.
Simple do this thing write below thing in terminal..
sudo gem install -n /usr/local/bin cocoapods
you do not need to install cocapods using sudo
try:
gem install cocoapods
then:
pod
to check if it runs fine