activesupport requires Ruby version >= 1.9.3 while running ruby 2 - ruby

I have Ruby v2 installed:
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin11.0]
but I get this error on multiple gems when I run:
$ sudo gem update
What's the problem and how do I fix it?
EDIT 1:
$ gem update
Updating installed gems
Updating actionmailer
Fetching: activesupport-4.1.8.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/1.8 directory.
EDIT 2:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/user/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
$ rvm info
-bash: rvm: command not found

The gem env was using an old version of ruby. I completely removed the gems via
gem list | cut -d" " -f1 | sudo xargs gem uninstall -aIx
(keep this terminal tab open so you know which gems you had and you can reinstall them) then opened a new terminal tab and then removed gem by doing
$ which gem
/usr/bin/gem
$ cd /usr/bin && sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem gem1.8.7 && sudo rm gem
I symlinked gem to gem1.8.7 if I want to use it later on.
Then I followed directions here https://rubygems.org/pages/download to reinstall gem with the latest ruby version, in my case Ruby 2.1.2p95.

Related

bundler, command not found

I wanna use the bundler, but after I installed rbenv, ruby and bundler, it still tells me command not found.
$ rbenv version
2.2.3 (set by /Users/khlee/.rbenv/version)
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
$ export GEM_HOME=$HOME/Software/ruby
$ gem install bundler
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
1 gem installed
$ rbenv rehash
$ bundle install
-bash: bundle: command not found
Execute below command and check list of gem in gemset:
rbenv gemset list
May be budler gem is not installed in current gemset.

Why doesn't nokogiri install?

I'm having a devil of a time installing Nokogiri on Ubuntu 12.04. I use rbenv.
$ gem install nokogiri -v '1.6.1'
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.1/.autotest
$ sudo gem install nokogiri -v '1.6.1'
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2.
$ rbenv sudo gem install nokogiri -v '1.6.1'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/deploy/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
Gem files will remain installed in /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ sudo ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rbenv sudo ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ echo $PATH
/home/deploy/.rbenv/bin:/home/deploy/.rbenv/bin:/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
It seems like I need some way of having sudo ruby -v give me 2.0.0. What am I missing?
You shouldn't need sudo when you do gem install with rbenv. Unfortunately, the ownership is usually not correct for the .rbenv directory on a new install.
Do this first to set your permissions correctly:
sudo chown -R $USER "$HOME/.rbenv"
Then go ahead and just run the install again:
gem install nokogiri -v '1.6.1'
It should work without sudo.
This works fine, but make sure to restart your terminal window after running sudo chown.
sudo chown -R $USER "$HOME/.rbenv"
# close terminal, then run the gem install
gem install nokogiri

How can I install a ruby gem that cannot be found?

I'm attempting to install s3nuke. From an up to date Mac OS with up to date ruby and gems.
First I cloned the git repository to my /var/src/ (now /var/src/s3nuke).
The install on the README is simple enough:
gem install s3nuke
Response:
ERROR: Could not find a valid gem 's3nuke' (>= 0) in any repository
Most help on this error assume I'm behind some proxy. I'm not. I can ping rubygems or rubyforge just fine. I can update successfully and even install other gems. Here are some examples:
$ gem -v
1.8.24
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
$ gem install rubygems-update
Successfully installed rubygems-update-1.8.24
1 gem installed
Installing ri documentation for rubygems-update-1.8.24...
Installing RDoc documentation for rubygems-update-1.8.24...
$ update_rubygems
RubyGems 1.8.24 installed
$ sudo gem update --system
Latest version currently installed. Aborting.
So let's try some other gems:
$ gem install eventmachine
Fetching: eventmachine-1.0.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed eventmachine-1.0.0
1 gem installed
Installing ri documentation for eventmachine-1.0.0...
Installing RDoc documentation for eventmachine-1.0.0...
$ gem install clamp
Fetching: clamp-0.5.0.gem (100%)
Successfully installed clamp-0.5.0
1 gem installed
Installing ri documentation for clamp-0.5.0...
Installing RDoc documentation for clamp-0.5.0...
So I'm up to date, and can install other gems. But s3nuke still won't budge.
$ gem install s3nuke
ERROR: Could not find a valid gem 's3nuke' (>= 0) in any repository
I even added another gem source (http://gems.rubyforge.org/), but still no luck.
Can you help?
Here's my env:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.a
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-12
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/my_username/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/", "http://gems.rubyforge.org/"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gems.rubyforge.org/
I'd try to install manually, but the s3nuke git repository doesn't include a s3nuke.gem.
What do you recommend?
if you use bundler, you can add to your Gemfile next line:
gem "s3nuke", :git => "git://github.com/SFEley/s3nuke.git"
Or you can install with specific_install gem
gem install specific_install
gem specific_install -l http://github.com/SFEley/s3nuke.git
You can directly add the following line to your Gemfile:
gem 's3nuke', :git => 'git://github.com/SFEley/s3nuke.git'
The gem will be installed the next time you do bundle install (assuming you're using Bundler)

tracks: gem::installerror

I have a problem installing gems for tracks. I performed the following steps:
Installation of rvm:
bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
Installation of ruby:
rvm install ruby-1.8.7
rvm use ruby-1.8.7 --default
ruby -v
Last command responds:
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Git clone of tracks:
git clone https://github.com/TracksApp/tracks.git
cd tracks
nano backup.rails2.3/Gemfile.rails2.3
Changes made in this flie:
- comment out gem "sqlite3"
- change gem "ZenTest", "=4.6.0"
After this i performed bundle install which exits with the following error:
Gem::InstallError: factory_girl requires Ruby version >= 1.9.2.
An error occured while installing factory_girl (3.3.0), and Bundler cannot continue.
Make sure that `gem install factory_girl -v '3.3.0'` succeeds before bundling.
Tracks does not support ruby 1.9.x so version upgrade is not possible. How can I fix above mentioned problem?
You have cloned deveopment version which seams be getting ready for Ruby 1.9:
https://github.com/TracksApp/tracks/blob/master/Gemfile#L51
Either use it with ruby 1.9 or use older version:
https://github.com/TracksApp/tracks/tags

Error installing ScrAPI gem: ffi requires Ruby version >= 1.9.2

I am having issues installing the ScrAPI gem:
ERROR: Error installing scrapi:
ffi requires Ruby version >= 1.9.2.
I am running RVM and if I do ruby -v I get:
ruby -v
ruby 1.9.2p110 (2010-12-20 revision 30269) [i686-linux]
I am guessing you did
$ sudo gem install scrapi
sudo ruby -v
Unless you followed Wayne's sudo RVM install I'm guessing root uses a different ruby.

Resources