I received a new Macbook Pro for work and started to setup my local machine for development. I installed RVM, then proceeded to install different ruby versions: 2.1, 2.0, 1.9, and 1.8.7. I need 1.8.7 because I will be working on an older site running this legacy version of ruby.
Anyway, when I type: rvm install 1.8.7, rvm installs both 1.8.7-p374 and 1.8.7-head. These installs were successful. When I type: rvm use 1.8.7, it defaults to the ruby-1.8.7-head version.
Why does rvm insist on installing both versions of ruby 1.8.7?
Please specify explicit full version of ruby to install:
rvm install 1.8.7-p374
In case of version ruby-2.0, you get the only version because there is the only one for the specified.
Related
I have installed RVM successfully on my Mac and using it I have installed Ruby 2.6.3. I have set my current and default version of Ruby to be 2.6.3. Everything seems to be fine because when I enter ruby -v into the terminal it tells me I'm using ruby 2.6.3.
My problem comes when I try to install Rails 6, I'm entering:
gem install rails --version=6.0.0 -no-ri -no-rdoc
It seems to install correctly however when I try to confirm with:
rails -v
I get:
Rails 6 requires Ruby 2.5.0 or newer.
You're running
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64- darwin18]
Please upgrade to Ruby 2.5.0 or newer to continue.
Why am I getting this message when my ruby -v command is telling me that I am using ruby 2.6.3
Any help would be very welcome.
You're running ruby 2.3.7p456. You need to set your local ruby version to 2.6.3.
Try which ruby to see which ruby version is loaded.
rvm install 2.6.3
rvm use 2.6.3
You can then see which ruby is running with which ruby.
See the basics on the rvm docs
As an aside, I also recommend recommend rbenv over rvm; however, you can only have one installed. If you have both installed, you're going to have a bad time.
To make sure you do not have both installed try which rbenv, and that should return rbenv not found
Please edit your original question with the output of the following commands:
which -a ruby
echo $PATH (That will help debug if your $PATH is set up incorrectly.)
which rbenv
ls (in your project directory)
i also had the similar problem which i resolved by uninstalling rvm completely and then installing rbenv.
Is it possible to run a Ruby application that was developed in Ruby 2.1.2 on a machine that has Ruby 2.1.5 installed? I'm new to Ruby and I'm starting to think that's not possible. A newer version of Ruby cannot run an older one? Can someone confirm?
When I type "rails server" I get the error message saying "You ruby version is 2.1.5, but your Gemfile specified 2.1.2 (Bundler::RubyVersionMismatch)". One of the messages it gives me is "ruby-2.1.2 is not installed". And then it says "To install do: rvm install ruby 2-1-2"
I tried commenting out the ruby version in Gemfile and/or changing the version number but I get more error messages now:
Juste remove/comment your version of ruby specified in Gemfile like this
#ruby '2.1.2'
Or install ruby '2.1.2' with RVM (Ruby Version Manager) on your environment:
RVM
In terms of recent history, the biggest shift in the Ruby language was between Ruby 1.8 and Ruby 1.9 where a number of things caused conflict due to changes in syntax and enforcing UTF-8 encoding.
Ruby 2.0 and 2.1 introduce more features but don't really impact backwards compatibility. It's very rare that a shift from 2.1.2 to 2.1.5 would cause problems with one exception:
You will probably need to reinstall all your bundled gems.
Normally this is done with:
bundle install
Note that Bundler itself is a gem, so you may need to install that if the bundle command is not available for that version of Ruby:
gem install bundler
If you're having a conflict due to mismatched Ruby versions in your Gemfile, edit that file to reflect your desired version.
Many multi-version Ruby managers like RVM and RBenv use a .ruby-version file in the main application directory to specify this instead. This is a gentler approach than locking down your Ruby version in the Gemfile itself.
If you need to install a new version of Ruby on your server:
rvm install 2.1.5
rvm --default 2.1.5
rvm use 2.1.5
gem install bundler
bundle install
That should make it available.
I've just started learning RoR and I've come across a problem.
ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
But when I try to install version 1.9.3 this is what happens:
rvm install 1.9.3
Already installed ruby-1.9.3-p484.
To reinstall use:
rvm reinstall ruby-1.9.3-p484
Sorry if it's a noob question, I've just started learning.
I'm running Elementary OS (Ubuntu based distro)
Make ruby 1.9.3 default, or even better use ruby 2.1 if you are just starting with Rails 4.2
rvm --default use 1.9.3
or better
rvm install 2.1
rvm --default use 2.1
Ruby 1.9.3 is already installed. To use it, write
rvm use 1.9.3
To make it the default version, use
rvm --default use 1.9.3
And to get all your ruby versions installed, use
rvm list
Since RVM performs non-standard installs, the new version won't be automatically chosen.
You have to explicitely "enter" the new Ruby environment with
rvm use 1.9.3
I'm getting the next error installing RoR
How can I set the correct Ruby Version?
#####:path$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
#####:path$ sudo gem install rails
ERROR: Error installing rails:
activesupport requires Ruby version >= 1.9.3.
#####:path$
You shouldn't have to use sudo with gem install .... That's what's causing the mismatch between Ruby versions, since root is using the default installed Ruby, whereas your own account is using RVM's installed version.
Updating the system version of Ruby depends on your operating system, and usually lags behind the very latest version of Ruby. I've been using 2.0 for my latest project I launched last month. I doubt big OS vendors like Ubuntu or Apple are providing that version in their latest distribution. It's best that you manage your own Rubies whenever possible.
To install 1.9.3 you can run:
$ rvm install 1.9.3
then later
$ rvm use 1.9.3
You have :
###:path$ ruby -v
.....
###:path$ sudo gem install rails
...you said in your comment that :
$ sudo ruby -v
...gives you
ruby 1.8.7
To resolve this problem you shouldn't use sudo, as it tries to install using root session with 1.8.7 ruby version which is not supported.
To install rails just type the following without sudo:
$ gem install rails
...it should works as you've a supported ruby version (ruby 2.0.0p247)
You can check Install Ruby on Rails ยท Ubuntu Linux instructions (Which I found useful) if you've more troubles.
I'm installing Ruby using MacPorts.
After using the following command:
sudo port install rb-rubygem
I got the following error:
Error: Port rb-rubygem not found
What should I be doing?
This post is old but I'll add this here. If you want to use mac ports you can add ruby by using sudo port install ruby and then sudo port install rb-rubygems (notice you missed the 's' in rubygem*s* in your original post). You can always check what repositories are available in mac ports by typing port list. Hope this helps.
Ruby is installed by default in every mac. However, it's ruby 1.8, which is very old and shouldn't be used in any of your projects.
Take a look at rvm.
It will allow you to install several versions of ruby in the same system.
So, for example, you can do the following :
rvm use 1.9.3
ruby -v #=> ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin12.2.0]
rvm use 2.0.0
ruby -v #=> ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
Using rvm, you can install any new version of ruby using the following :
rvm install 2.0.0-p0 #=> This will install Ruby 2.0.0
rvm install jruby #=> This will install jruby
And so on