I am trying to install cocoapods in my mac, but I can't get it installed. It shows the following error:
$ sudo gem update --system*
Latest version currently installed.
Aborting.
$ sudo gem install cocoapods**
Successfully installed cocoapods-0.34.4
Parsing documentation for cocoapods-0.34.4
1 gem installed
$ pod setup
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 200 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/(user name)/.rvm/gems/ruby-1.9.3-p374:/Users/vamshiraghu/.rvm/gems/ruby-1.9.3-p374#global', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:58:in `gem'
from /usr/bin/pod:22:in `<main>'
So does anybody know about this error to sort it out?
I have same problem. I got different kinds of error when try different combination of install and uninstall. like
[!] The `master` repo requires CocoaPods 0.32.1 -
or
.rvm/gems/ruby-2.0.0-p598/gems/claide-0.4.0/lib/claide/command.rb:217:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)
or
.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- colored (LoadError)
from /Users/riverhuang/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5#global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:8:in `<module:UserInterface>'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5#global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:7:in `<module:Pod>'
.
.
.
from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `load'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `<main>'
Could not find proper version of cocoapods (0.29.0) in any of the sources
Run `bundle install` to install missing gems.
After clear all gem in my computer I finally fixed it. Here is my steps to clear all gems.
gem uninstall --all
sudo gem uninstall --all
After uninstall all gems I reinstall the cocoapods.
sudo gem install cocoapods
Then restart the Terminal and run:
pod setup
I guess it has conflict in dependency gems (wrong version or not in right path). Like once I run "bundle install" it always install cocoapods 0.29.0 and all its dependency. With and without "sodu" install gems and its dependency to different places with version 0.36.2 when I did it.
Related
I'm using 'ffi', '~> 1.9',
I'm getting this error when I try to run my rails project
rake aborted!
LoadError: dlopen(/Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle, 0x0009): tried: '/Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) - /Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle
/Users/kanye.west/dev/anenta/config/application.rb:14:in `<top (required)>'
/Users/kanye.west/dev/anenta/Rakefile:5:in `require'
/Users/kanye.west/dev/anenta/Rakefile:5:in `<top (required)>'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `load'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `<main>'
Caused by:
LoadError: cannot load such file -- 2.6/ffi_c
/Users/kanye.west/dev/anenta/config/application.rb:14:in `<top (required)>'
/Users/kanye.west/dev/anenta/Rakefile:5:in `require'
/Users/kanye.west/dev/anenta/Rakefile:5:in `<top (required)>'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `load'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
Approaches tried
gem install --user-install ffi -v '1.9.25' -- --enable-libffi-alloc
gem install ffi -v '1.9.25' -- --with-cflags="-Wno-error=implicit-function-declaration"
gem install ffi -v '1.9.25' --platform=rub
alias gem="arch -x86_64 sudo gem"
CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/opt/homebrew/opt/readline' gem install ffi -v '1.9.25' -- --with-cflags="-Wno-error=implicit-function-declaration"
You need to install libffi using homebrew:
brew install libffi
Then the installation should succeed with:
gem install ffi
I've tested this on ruby 2.7.2 on my m1.
Also make sure that both libffi and ruby/gem are running on the same architecture. You may have mixed some arm64 and x86 binaries which will lead to lots of compiler errors in the long run. If you encounter "wrong architecture" errors, try to reinstall ruby/homebrew on arm/m1.
For reference:
I'm using chruby installed through homebrew and installed ruby 2.7.2 via ruby-install.
Both homebrew and ruby are not using rosetta emulation and are compiled on arm64. I've installed libffi using brew install and then installed ffi using gem install without problems.
pascal#0xc0fefe ~> which ruby
/Users/pascal/.rubies/ruby-2.7.2/bin/ruby
pascal#0xc0fefe ~> which ruby-install
/opt/homebrew/bin/ruby-install
pascal#0xc0fefe ~> file /Users/pascal/.rubies/ruby-2.7.2/bin/ruby
/Users/pascal/.rubies/ruby-2.7.2/bin/ruby: Mach-O 64-bit executable arm64
pascal#0xc0fefe ~> gem install ffi
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 0 seconds
1 gem installed
Here's the only workaround I found working, download Rosette, https://support.apple.com/en-us/HT211861, and uninstall (you need to do this in order for anything not compatible with the current architecture):
ruby versions
homebrew
rbenv
and select Get Info on Terminal, and check the Open using Rosetta.
Now reinstall
homebrew
rbenv
ruby
Run ruby -v
Check and verify that your version has ... [universal.x86_64-darwin21]
The thing is that official support for M1 was added in ffi v 1.14.0, so try update to that version, should not break anything.
gem uninstall ffi
and change manually in Gemfile.lock to 1.14.0.
gem install ffi -v '1.14.0'
This is what worked for me.
I've been trying to install a demo React Native App that innocently asked to run pod install and the went down this ffi rabbit hole.
On my M2 / Monterey, this article worked well except it was missing the instruction to install the ruby plugin for asdf
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
Working in Rubymine form windows using wsl and running everything with wsl terminal Im getting the following error from rubocop all the time:
Error:/home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:91:in `block in materialize': Could not find ffi-1.15.1 in any of the sources (Bundler::GemNotFound)
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:85:in `map!'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:85:in `materialize'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:170:in `specs'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:237:in `specs_for'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:226:in `requested_specs'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:108:in `block in definition_method'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:20:in `setup'
from /home/dor/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/bundler.rb:107:in `setup'
from /home/dor/ ...
this is quite annoying.
also bundle keeps asking to bundle install together with this error which I ran and did not help
For whatever command you are running, make sure that you're using bundle exec, for example:
$ bundle exec rubocop
Next, you can try the following:
Install ffi manually to see if your Gem path is set up correctly: gem install ffi
Re-install bundler: gem uninstall bundler && gem install bundler
Remove the Gemfile.lock file (make a backup) and re-run bundle install.
Run bundle update or bundle update ffi
Try bundle --full-index (ref)
I see that you're not using JRuby, but I've also had problems where I had to use bundler (with an R) instead of bundle for JRuby, so you could try that.
For WSL specifically, I also found other people having this issue with Jekyll and WSL. The solution was to fix the GEM path. Follow the instructions here.
If still none of this helps you, please describe how you're installing Ruby on WSL and what command you are using that produces this error.
While following https://cloud.google.com/solutions/migrating-ruby-on-rails-apps-on-heroku-to-gke I get the error:
"/usr/local/lib/ruby/2.6.0/rubygems.rb:283:in find_spec_for_exe': Could not find 'bundler' (2.2.15) required by your /usr/src/app/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.15`
from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/bundle:23:in `<main>'"
when I try to run: docker build -t ruby-app .
Anybody know what's wrong?
Adding the line
RUN gem install bundler
in the Dockerfile before the line
RUN bundle install
did the trick.
I got a Rails project that uses Ruby 2.5.3 and I can run bin/rake --tasks from the terminal just fine:
$ rbenv version
# 2.5.3 (set by /Users/me/myproject/.ruby-version)
However, I get a message each time RubyMine telling me that rake --tasks can't be executed.
This is more of a nuisance than a real problem but I still want to get this fixed.
Interestingly, a different rubyframework 2.6.0 is used and it is the "native" ruby rather than one of my rbenv installations:
Error:[rake --tasks] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /Users/besi/Dropbox/projects/boexli/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.0.2`
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/bin/bundle:23:in `<main>'
Error:[rake --prereqs] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /Users/besi/Dropbox/projects/boexli/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.0.2`
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/bin/bundle:23:in `<main>'
I think, if I could change that framework 2.6 to my default 2.5.3 the issue would be resolved, but I can't seem to find that setting.
The SDK from which that task is executed does not show up the SDK Dialog at all.
while installing therubyracer along with Ruby 2.0.0.p0 and Rails 4.0, i get the following error
ERROR: While executing gem ... (NoMethodError)
undefined method `size' for nil:NilClass
If I install same gem in using bundle install then I get dependent gem error see below log.
NoMethodError: undefined method `size' for nil:NilClass
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
Please find the link for GIT which i was trying to install
https://github.com/niquola/angularjs-on-rails
I ran to the same problem today. And got it solved. I'm using Lubuntu 13.04, RVM and Ruby 1.9.3 instead.
It could be that your platform is not in the supported list of libv8, which is used by rubyracer, and the gem should be compiled by yourself.
Straight from: https://github.com/cowboyd/libv8
Get libv8 source from git, compile it and build gem from:
git clone git://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake checkout
bundle exec rake compile
bundle exec rake build
Install gem:
gem install ./pkg/libv8-3.16.14.3.gem
I still got an error when executed "bundle update" on my project folder, because gem didn't seem to be copied to my bundle gem cache.
Bundler::GemspecError: Could not read gem at /home/devmachine/.rvm/gems/ruby-1.9.3-p448/cache/libv8-3.16.14.3.gem. It may be corrupted.
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
So I copied it to this folder before I ran "bundle update" again:
cp /home/devmachine/Downloads/libv8/pkg/libv8-3.16.14.3.gem /home/devmachine/.rvm/gems/ruby-1.9.3-p448/cache
Keep in mind that you should have following packages installed before performing compilation:
git
git-svn
libv8-dev
python
g++
I hope it helps.
- = Better solution = -
Actually a case of RTFM.
You dont have to build your own gem with native extension. You just have to have v8 library present in your system. After that you can configure bundler to use native v8. For that you should install V8 engine on your system.
# Get Google v8 engine from git
git clone git://github.com/v8/v8.git v8 && cd v8
# Install GYP
make dependencies
# I had problems with warnings and strict aliasing. So I ignored and switched them off.
make native werror=no strictaliasing=off
Now you should be able to use v8 from system:
bundle config build.libv8 --with-system-v8
After this command you can continue using usual "bundle install"..
- = Suggested solution = -
Forget v8 and use Node.js instead:
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
# cd into extracted directory (e.g. cd node-v0.10.14)
make
make install
Remove "therubyracer" dependency from your project Gemfile.