Unfortunately, I recently upgraded the system Ruby to 2.3 on my Mac. Since I have to use Cocoapods 0.39 for a specific project which does not properly work, I would like to use an older version of Ruby. For this purpose, I installed RVM and then switched to ruby-2.2-head:
> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> rvm install 2.2-head
> rvm use 2.2-head --default
This worked fine. Then I tried to install Cocoapods and got the usual error message:
> rvmsudo gem install cocoapods
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
which I silenced by chosing the second option. Then I checked Cocoapods and got a fantastic error message:
> pod --version
/Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:278:in `activate_bin_path'
from /Users/bastian/bin/pod:22:in `<main>'
Furthermore, Cocoapods is not listed with the following command:
> gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
Cocoapods seems to be installed into the wrong directory:
> which pod
/Users/bastian/bin/pod
So if I switch back to the system Ruby, the pod --version command returns 0.39.0.
I guess that somehow Cocoapods was not installed with the RVM Ruby but rather with the system version. What did I do wrong?
With the help of "How to get RVM to set correct gem path" I was able to solve the problem. I don't know why but the removal of the single entry --user from .gemrc solved this problem for me. Since the file only contained this one line I just renamed it and reinstalled Cocoapods:
> mv ~/.gemrc ~/.gemrc_backup
> gem install cocoapods`
Now Cocoapods is working again as it resides at the correct path:
> which pod
/Users/bastian/.rvm/gems/ruby-2.2-head/bin/pod
Related
Not sure what to do to specifically fix this problem, googled and nothing solved my question. When I try to:
bundle exec jekyll serve
I get told:
Could not find eventmachine-1.2.7 in any of the sources
Run `bundle install` to install missing gems.
Then I:
bundle install
Only to get this:
Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /private/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201130-34411-pd54nh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/gems/eventmachine-1.2.7 for
inspection.
Results logged to
/var/folders/7f/2c2swwc1153899dmr8781_x40000gn/T/bundler20201130-34411-1lzt2fceventmachine-1.2.7/extensions/universal-darwin-20/2.6.0/eventmachine-1.2.7/gem_make.out
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
minima was resolved to 2.5.1, which depends on
jekyll-feed was resolved to 0.13.0, which depends on
jekyll was resolved to 4.0.0, which depends on
em-websocket was resolved to 0.5.1, which depends on
eventmachine
Where am I going wrong here? Just updated to macOS 11.0.1, this is my first time trying to serve jekyll since the update. Thanks y'all!
Just try:
gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
I had the same problem on Big Sur and this solution worked perfectly:
How to fix Jekyll after upgrading to MacOS 11 (Big Sur)
Download XCODE 12 beta from here and copy it to the Applications folder.
Then follow these steps to install rbenv.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility. see: https://github.com/rbenv/rbenv#basic-github-checkout
xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Now in your Jekyll project's root, you should be able to run bundle install and it should install all missing dependencies and should work now.
I didn't have to build ruby or install XCode. While Jekyll requires Ruby 2.4.0 or higher and Big Sur comes with 2.6.3, I followed Jekyll's instructions to install the latest version of Ruby.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby
Add Ruby to your shell configuration in .bash_profile.
PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH
Install bundler. I had to upgrade to Jekyll 4.2 from 4.0, and install webrick which is no longer a default gem with Ruby 3.0. If Jekyll is installed globally, then install it, webrick, and any other gems, like jekyll-paginate, too.
gem install --user-install bundler jekyll
Add the gems path to your shell configuration in .bash_profile, replacing X.X with with first two digits of the Ruby version.
PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"
export PATH
I just wanted to convert from ImageMagick v7 to ImageMagick v6.
while doing that, this error was happened.
bundle install doesn't work correctly.
It seems like json version is something wrong.
How do I fix this error?
Environment below
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]
Rails -v (couldn't find gem) (becuase bundle install can't work)
json list / json (default: 1.8.3)
multi_json (1.13.1, 1.11.2, 1.11.0)
Bundler version 1.16.4
Mac Mojave 10.14
when I do bundle install on terminal, then I got this error
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.......
Using rake 12.3.2
Using concurrent-ruby 1.1.4
Using i18n 0.9.5
Fetching json 1.8.6
Installing json 1.8.6 with native extensions
Errno::EPERM: Operation not permitted # chmod_internal -
/Users/***/projects/***/vendor/bundle/ruby/2.3.0/gems/json-1.8.6/tests/test_json.rb
An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 4.2.6, which depends on
actionmailer was resolved to 4.2.6, which depends on
actionpack was resolved to 4.2.6, which depends on
actionview was resolved to 4.2.6, which depends on
rails-dom-testing was resolved to 1.0.9, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
activesupport was resolved to 4.2.6, which depends on
json
I tried to do like this because error statement says Make sure that
gem install json -v '1.8.6' --source 'https://rubygems.org/' succeeds before bundling
but result shows like this
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted # chmod_internal - /Users/***/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.8.6/tests/test_json.rb
I can't understand this error statement
Errno::EPERM: Operation not permitted # chmod_internal -
Also, I goggled a lot, then I update commandlinetool follow this
https://howchoo.com/g/m2u0mmuwzda/macos-mojave-fix-invalid-active-developer-path
then, I did this command again,
sudo gem install json -v '1.8.6' --source 'https://rubygems.org/'
then, it's completely succeded like this.
Building native extensions. This could take a while...
Successfully installed json-1.8.6
Parsing documentation for json-1.8.6
Installing ri documentation for json-1.8.6
Done installing documentation for json after 1 seconds
1 gem installed
But, if I do bundle install, still doesn't work: they show same error.
My recommendation is if possible to start fresh. Maybe your rbenv was not installed correctly, try reinstalling it, I suggest using brew install rbenv https://github.com/rbenv/rbenv#homebrew-on-macos
Make sure to add the eval "$(rbenv init -)" to your ~/.bash_profile then open a new terminal.
Navigate to the project directory and install the Ruby version you need: rbenv install 2.3.1
You can make sure you are using that version by issuing rbenv use 2.3.1 and ruby --version.
Now install bundler for that Ruby version, I suggest 1.17.3 for now (the latest before 2.0.1) gem install bundler -v '1.17.3'.
You should be ready to bundle install.
The most common scenario I see for a message Installing ... with native extensions to result in errors is usually due to the lack of binaries, header files and C related code to build that native extension, in your case the issue is due to permissions, hence why I am suggesting some fresh installation.
I second #Danilo Cabello's recommendation to start fresh if you can. I just have a few other trouble-shooting ideas:
The fact that your bundle is installing gems in /vendor/bundle means that at some point, you must have specified the path with bundle install --path vendor/bundle as #mogbee alludes to. That path flag will load files associated with your gems into vendor/bundle instead of your system gem location. You might have done that if you're trying to keep the project's gems separate from any other project, but if not, you will need to update your bundler's gem path.
To do this, first, check for any issues by running bundle doctor. If no issues are found, check your bundle configuration with bundle env. Make sure that your RubyGems Gem Home and Gem Path are routed through .rbenv, so they should match and look like /Users/***/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0. If they don't match, run the rbenv-doctor command below which should make sure your rbenv installation exported the path properly.
If the output of bundle env tells you that you're actually running an older version of bundler (older than 1.16.4), I would definitely update, and would recommend version 1.17.3 as #Danilo Cabello did.
Second, I would run this rbenv-doctor curl command to check the status of your rbenv install: curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash (https://github.com/rbenv/rbenv-installer#rbenv-doctor).
Third, depending on the output of ls -l within your project folder, you may also want to recursively change owner/group for your ~/.rbenv folder to make sure everything is owned by you and not root (https://superuser.com/questions/260925/how-can-i-make-chown-work-recursively/260939#260939)
I uninstalled RVM and re-installed using a single user installation using:
\curl -L https://get.rvm.io | bash -s stable
When I do bundle, it prompts for:
Enter your password to install the bundled RubyGems to your system:
I tried using the answer in "ERROR: While executing gem … (Gem::FilePermissionError)" which did not fix it.
Then, while trying to install the gem manually, I got:
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
then running gem install nokogiri -v '1.6.0' returned:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
I checked all the similar posts on SO, but they didn't solve the problem. What am I missing?
I spent a lot of time fixing this issue on my MacBook. The gem update --system does not work for me.
At last, putting the following code in the ~/.zshrc file and create a new zsh session works for me.
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
after you install RVM you still need few more steps:
Load RVM to the current shell:
source ~/.rvm/scripts/rvm
Usually this would not be needed if you close and open your terminal again
Install ruby:
rvm install ruby
Use ruby:
rvm use ruby
The last step is very important as your error message mentioned system ruby not the one controlled by RVM.
Make sure to update your system rubygems with this command : sudo gem update --system --no-user-install.
bundler use it instead your local version and your bundler version could be incompatible with your system rubygems.
It works for me ;)
TL;DR:
$ gem install rubyzip
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
And now in detail. I'm not sure which information is relevant, so I'm just gonna say it all.
I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
Everything worked just fine for a while
Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
The warning kept on popping up, so I tried to remove the gemset with rvm gemset empty, which also failed, because of some permission denied error (yes stupid me didn't write it down)
In result of that, I reinstalled Ruby via rvm remove 1.9.2 and rvm install 1.9.2 (I didn't forget to rvm use 1.9.2 --default after that.
I installed bundler gem install bundle and then tried to bundle install in my Rails 3.1.1 project, but it ends with error
Installing rubyzip (0.9.4)
Errno::EPERM: Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
An error occured while installing rubyzip (0.9.4), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '0.9.4'` succeeds before bundling.
gem install rubyzip -v '0.9.4' gives the above mentioned error
The README file says to download source and install from there via ruby install.rb, which also ends in error
$ ruby install.rb
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:841:in `install': wrong number of arguments (4 for 3) (ArgumentError)
from install.rb:21:in `block in <main>'
from install.rb:18:in `each'
from install.rb:18:in `<main>'
Even executing tests fro rubyzip ends up in bunch of errors
$ rake test
rake/gempackagetask is deprecated. Use rubygems/package_task instead
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
/Users/darth/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -C test alltests.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- stdrubyexttest (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from alltests.rb:5:in `<main>'
rake aborted!
Command failed with status (1): [/Users/darth/.rvm/rubies/ruby-1.9.2-p136/b...]
Tasks: TOP => test
(See full trace by running task with --trace)
I'm out of ideas, what can I do?
I'm really not sure what caused this, but I managed to fix it by doing the following.
Since reinstalling Ruby 1.9.2 didn't help, I decided to be even more drastical and went down to rvm. I found out that I had version 1.1.something installed, which is about 9 months old.
I tried to update, but it didn't help, so rvm implode did the trick. I even had to sudo rm -rf ~/.rvm, probably because I managed to mess up some gem installs by adding sudo to them.
After reinstalling rvm and reinstalling 1.9.2, it seems like everything is working fine now, even with Xcode 4.2.
Lesson learned, rm -rf & reinstall is better than trying to upgrade from a year old version :)
I just recently began having trouble with bundler - bcrypt-ruby will not install when doing a bundle install or sudo bundle install and exits with the following error:
Installing bcrypt-ruby (2.1.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection.
Results logged to /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (2.1.4), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '2.1.4'` succeeds before bundling.
However, gem install bcrypt-ruby -v '2.1.4' runs just fine (and in fact has already been run on this box). Running /usr/bin/ruby1.8 extconf.rb manually works just fine, and the resulting Makefile also runs with make just fine.
I'm using Ruby 1.8.7 and bundler 1.0.21 on Ubuntu 10.04.1 LTS. Other gems seem to be working fine through bundler. Though this is probably obvious, I've confirmed that the ruby-dev, gcc, etc packages are installed. I've tried using the --deployment option with bundler with no different behavior. The only thing I can think that has changed recently is I did a bundle update a couple days ago, so bundle got a minor version change (1.0.10 -> 1.0.21) and bcrypt appears to have gotten a major version change (2.1.4 -> 3.0.1).
Any help is appreciated!
Have you upgraded to Lion since you installed Ruby 1.9.2? If so it is probably linked to the wrong gcc.
Try uninstalling and reinstalling 1.9.2, I would suggest using rvm
rvm uninstall 1.9.2
rvm install 1.9.2
If that does not work you might have to implode rvm
rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm install 1.9.2
try:
sudo apt-get install build-essential