I have an app using Rails 3.0.6 which I run on two machines. I started with ruby 1.8.7 and recently installed ruby 1.9. I swapped my link in '/usr/bin/ruby' to point to the 1.9 install. When I run 'ruby --version' I get the 1.9. However, in my rails app, when I check 'RUBY_PLATFORM' it shows rails is running with 1.8.7.
How do I tell Rails which ruby environment to use? Strangely, this is not the easiest thing to search for. Probably because I don't know enough about it to form a specific question.
1.2 Ruby VersionsRails 7 requires Ruby 2.7. 0 or newer. Rails 6 requires Ruby 2.5. 0 or newer.
Along with RVM, Rbenv has long been the most popular version manager for Ruby. Rbenv uses shims to intercept common Ruby commands. (Asdf also uses shims.) After installing Rbenv with Homebrew, you must modify your ~/.
https://rvm.io/rvm/install
Install RVM using these instructions, then you can manage and switch between different Ruby versions and gemsets very easily. Using RVM you can have both 1.8.7 and 1.9.x (or any other version) on your system without having to constantly manually change your path and ruby alias.
Older versions of RVM used the .rvmrc
file to automatically switch the ruby within a directory. Newer versions use the .ruby-version
file.
To switch between rubies, just type rvm use 2.0.0
or whatever version it is you want to use. For ongoing projects it's a good idea to add the .ruby-version
file in the root of the directory that contains the version string you want to use, i.e.
2.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With