0

I have installed Ruby (2.3.1) and Rails (5.0.0) with gem v2.6.4 on Arch Linux. Recently I've had need of working with Ruby 2.3.0 and Rails 4.2.6, so I tried to install RVM with these steps:

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 
$ \curl -sSL https://get.rvm.io | bash -s stable
$ source /home/user/.rvm/scripts/rvm
$ rvm install ruby-2.3.0
$ rvm use 2.3.0

I restarted my PC and in my shell tried to install rails with this:

$ rvm rubygems current

I got this message:

Installed rubygems 2.5.1 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.

After that, when I run this command:

$ rails -v

I got:

/usr/bin/env: ‘ruby_executable_hooks’: No such file or directory

Supposedly this code resolved the problem (I don't know really what I'm doing):

$ sudo gem install --user-install executable-hooks

It seems I cannot install an old version of rails, so how to work this $#@&~$ RVM? The documentation in RVM is lacking for me. This should be easy like virtualenv for Python.

Other questions:

  • What are the RVM gemsets for?
  • When y HOW to use them under my situation?
  • Must I add this code source /home/warcayac/.rvm/scripts/rvm in my .bashrc file?

Please, any help because I am starting to miss Windows @_@!

  • I'm not entirely sure what you are doing, but using rvm is just a matter of running their install script and then using `rvm install 2.3.0` and `rvm use 2.3.0`, not sure why you are running that rubygems command. Also you clearly never run Ruby on Windows for long enough if you say that. I did and Ruby can't work in that environment. – Francesco Belladonna Jul 07 '16 at 04:31
  • As I said "the documentation in RVM is lacking for me", I am following a video-tutorial (year 2015). So how to install Rails 4.2.6? may you recommend a full tutorial step by step? – Ουιλιαμ Αρκευα Jul 07 '16 at 04:38
  • Follow the two commands in homepage, then `rvm install 2.3.0` and `rvm use 2.3.0`. From this point, just use ruby (and gem) like you would normally do. `gem install rails` is enough, if you want a specific version use bundler or `gem install --version 4.x.x`, like normal ruby environment – Francesco Belladonna Jul 07 '16 at 04:45
  • Being in Ruby (2.3.1) /Rails (5.0.0) from system I decompressed a RoR project (named "AnyProject") whose Gemfile uses Ruby 2.3.0 and Rails 4.2.6, I entered this directory "AnyProject" and I got hits message: RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, you can ignore these warnings with 'rvm rvmrc warning ignore ~/Projects/RubyRails/AnyProject/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. – Ουιλιαμ Αρκευα Jul 07 '16 at 15:00
  • So RVM switched automatically to Ruby 2.3.0, that's OK, but when I run "rails -v" to check the Rails version being used I get this message: ~/.gem/ruby/2.3.0/bin/rails:22:in `
    ': undefined method `activate_bin_path' for Gem:Module (NoMethodError) from ~/.rvm/gems/ruby-2.3.0@global/bin/ruby_executable_hooks:15:in `eval' from ~/.rvm/gems/ruby-2.3.0@global/bin/ruby_executable_hooks:15:in `
    ' When I leave that directory, I returned to Ruby/Rails from system, and all is OK over there. My system has these versions installed for Rails gem: 5.0.0 , 4.2.6 What's going on?
    – Ουιλιαμ Αρκευα Jul 07 '16 at 15:00
  • Taking in consideration "just use ruby (and gem) like you would normally do", I run "bundle install --without production" into "AnyProject" directory and I got a error message about bundler; so I installed it "gem install bundler" and re-run "bundle install --without production", it installed several gems (I suppose gems from Gemfile), and I run again "rails -v" and all is OK now. I'm gonna test it further for an error. – Ουιλιαμ Αρκευα Jul 07 '16 at 16:18
  • Pending questions: - What are the RVM gemsets for? - When y HOW to use them under my situation? - Must I add this code source /home/warcayac/.rvm/scripts/rvm in my .bashrc file? – Ουιλιαμ Αρκευα Jul 07 '16 at 16:24
  • This post answered some questions: http://stackoverflow.com/questions/4689180/why-should-i-care-about-rvms-gemset-feature-when-i-use-bundler – Ουιλιαμ Αρκευα Jul 07 '16 at 16:51
  • This video also answered some questions: https://youtu.be/BWio5ZquplI – Ουιλιαμ Αρκευα Jul 07 '16 at 16:51
  • Ignore ruby gemsets, the main thing you are missing is when you are in your project, you must run _any_ command with prefix `bundle exec`, so `bundle exec rails -v`, `bundle exec rails c`, `bundle exec ruby whatever.rb` – Francesco Belladonna Jul 07 '16 at 18:12
  • Also, you probably have a .ruby-version file somewhere, that's why rvm is picking the right ruby version – Francesco Belladonna Jul 07 '16 at 18:13

1 Answers1

0

I recommend either of the two options:

1) removing all rvm files, then reinstall rvm:

—OR—

2) remove all rvm files, then install rbenv:

Compatibility note: rbenv is incompatible with RVM. Please make sure to fully uninstall RVM and remove any references to it from your shell initialization files before installing rbenv.


UPDATE

I've used rvm in the past, but currently I use rbenv on OS X. After installing rbenv on Linux, installing Ruby would probably look like:

$ rbenv install --list
Available versions:
 1.8.5-p113
 1.8.5-p114
 […]
 2.3.1
 2.4.0-dev
 jruby-1.5.6
 […]
$ rbenv install 2.3.1
[…]

Set the global version:

$ rbenv global 2.3.1
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Set the local version of your repo by adding .ruby-version to your repo's root dir:

$ cd ~/whatevs/projects/new_repo
$ echo "2.3.1" > .ruby-version
Community
  • 1
  • 1
SoAwesomeMan
  • 3,226
  • 1
  • 22
  • 25