I used to use rbenv to manage ruby versions. I uninstalled it because I had to switch to rvm to install an old version of ruby. Now in my project, if I do ruby -v I get ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] but when I try to create my database with bundle exec rails db:create I get rbenv: version '2.3.1' is not installed. Can someone help me with that ?
Related
When I run
ruby -v
i get ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
this is after installing the latest version of ruby with brew install ruby
tried uninstalling and reinstalling and same thing. How can I get the latest version of ruby? If relevent, I need it for gem install bundler which requires a later version.
This is how to update your ruby version steps
To check what your ruby in now
$Ruby -v
Update it to ruby version 2.3.7
$rvm list known
$rvm install 2.3.7
$rvm use 2.3.7 --default
$gem install bundler
Let me know if does that help!
I am just starting to work on an old Ruby Rails project. The Gemfile specifies:
ruby '2.0.0'
I am running a new version of Ubuntu, which I think came with Ruby 2.3 as the default. So I install RVM and then I:
rvm --default use 2.0.0
ruby -v
which gives me:
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
then I run:
bundle install
and I get this error:
Your Ruby version is 2.3.1, but your Gemfile specified 2.0.0
How do I get RVM to enforce the correct version of Ruby?
I'm trying to update Ruby from 2.0 to 2.4. The installation went through, but when I type in terminal ruby -v I'm shown the following:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
I have no clue on how override the old version. Any assistance would be awesome.
To make ruby 2.4.0 as your default ruby version :
rvm --default use 2.4.0
Now , ruby -v will show ruby-2.4.0
If not installed already then Run:
rvm install ruby-2.4.0
Reference : rvm documentation
In case of chruby, Run
chruby ruby-2.4.0
to make ruby-2.4.0 as default version
I have installed many flavors of ruby on rvm, and using following command to change rvm ruby versions.
rvm use 1.9.3
then ruby -v gives me following result
ruby 1.9.3p551 (2014-11-13 revision 48407) [i686-linux]
but when i try to run any commands like rails s or bundle install
it gives me following error
Your Ruby version is 2.3.1, but your Gemfile specified 1.9.3
Using
rvm list
you can get list of ruby version on your system along with current & default versions.
If ruby version is not specified in Gemfile, then it is generally considering default rvm version.
But if it is specified in Gemfile, then that version of ruby should be installed in your system along with its bundler.
First make sure ruby version either installing or using it,
rvm install '1.9.3'
rvm use '1.9.3'
To install bundle of required ruby version, run this command
gem install bundler
That's can happens, when you trying to use fresh installed ruby without bundler, all newest installed ruby should also include bundler installation.
$> rvm use 1.9.3 && gem install bundler # may terminal reload needed
$> bundle install
$> bundle exec rails s
When I try to run a ruby command in terminal I get an error:
Ruby >= 2.1.9 required to run app (You have 2.0.0)
When I try
brew upgrade ruby
I get
Error: ruby 2.3.1 already installed
Previously I tried installing ruby with rvm
curl -sSL https://get.rvm.io | bash -s stable --ruby
Maybe I have two different versions of ruby running?
How can I get my system to use the latest version of ruby?
EDIT: Definitely two versions installed
/usr/local/bin/ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
My $PATH seems correct?
-bash: /usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory
EDIT2 specifying the full path to the correct version of ruby:
/usr/local/bin/ruby app.rb
/usr/local/bin/ruby: No such file or directory -- app (LoadError)
In the simplest cases, you can just specify the fully-qualified PATH to your Homebrew-installed Ruby. For example:
/usr/local/bin/ruby /path/to/foo.rb
However, if you need to require gems or libraries, you need to step up your game with a Ruby version manager such as chruby, rvm, or rbenv. You should never replace the system ruby, and managing all the environments variables, gems, and so forth that Ruby needs without a version manager is outside the scope of a reasonable Stack Overflow question.
You have installed the homebrew version 2.3.1 of Ruby, but you are not using it because you haven't set your PATH correctly.
Try using the one homebrew installed for you by adding /usr/local/bin to the start of you PATH, or by running:
/usr/local/bin/ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
I guess if you use the Apple-supplied Ruby in /usr/bin you will get:
/usr/bin/ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
You should uninstall ruby from brew and just use rvm.
If you have multiple version installed than you can use rvm to make ruby 2.3.1 your default: rvm --default use 2.1.1