installed ruby using apt-get install ruby 2.0.0 succeeded but not using correct ruby version
If you're new to linux I'd recommend using something like RVM (Ruby Version Manager) to install ruby. It makes it easier to switch ruby versions and manage multiple gemsets.
To install RVM with the latest (stable) ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby
then check which rubies are installed by using
rvm list
you can then switch ruby versions using
rvm use 2.0.0 --default
with the --default
flag overriding any system ruby.
Update
If you really don't want to use RVM, then use
sudo apt-get install checkinstall
wget -c http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar -xzf ruby-2.0.0-p0.tar.gz
cd ruby-2.0.0-p0
./configure
make
sudo checkinstall -y \
--pkgversion 2.0.0-p0 \
--provides "ruby-interpreter"
checkinstall
will package the source, making it easier to remove in the future
You'll then need to add the Ruby binaries to your path, by editing the env file:
sudo nano /etc/environment
add /usr/local/ruby/bin
PATH="/usr/local/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
then run
source /etc/environment
to reload the file, and check your ruby version with
ruby -v
How to fix Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5 while server starting
You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.
If you're using rvm:
rvm install 2.2.5
rvm use 2.2.5
else if you're using rbenv:
rbenv install 2.2.5
rbenv local 2.2.5
else if you can not change ruby version by rbenv,
read here
i'm try to install ruby on rail , after installing cocoapods but it has same error
You need to update the Ruby version, you are using an old version of Ruby.
Check out this post to see how to update the Ruby version if you are using MAC
How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?
or this for windows
How to update ruby in windows
An error occurred while installing ruby-2.0.0
Ruby 2.0.0 is very old, and not supported on Heroku anymore. You need to upgrade to a more recent version.
You can see all the supported ruby versions here: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
How to change versions of Ruby 1.9 to Ruby 2.0 in the new Windows 10 Bash shell?
Currently, WSL is based on Ubuntu 14.04, so there are no recent Ruby versions available with the official apt repos.
You can install Ruby 2.1, 2.2 and 2.3 via Brightbox/ruby-ng ppa repository if you prefer managing packages with apt.
Quoting from the Brightbox site:
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
And then,
sudo apt-get install ruby2.1
Otherwise, rbenv is an another option to achieve that.
bundle install doesn't succeed
I found the reason of this failure, which was the compatibility of the versions of those gems and ruby version.
I very much knew that could be a problem, but I thought I made sure I set the proper ruby version for the gems versions specified in the Gemfile/Gemfile.lock. What I did miss was the trace of misconfigure of rbenv, which is shown as '2.3.0' in the log. What I thought it should have been was '2.0.0'.
Since I didn't do good rbenv setup, bundler was referring to the ruby not in the project directory. Hence obvious version incompatibilities.
Related Topics
Differencebetween Pluck and Collect in Rails
What Is the Purpose of "!" and "" at the End of Method Names
How to Replace a Hash Key with Another Key
Get Index of Array Element Faster Than O(N)
Merge and Interleave Two Arrays in Ruby
Correctly Doing Redirect_To :Back in Ruby on Rails When Referrer Is Not Available
Change the Name of the :Id Parameter in Routing Resources for Rails
Get Current Stack Trace in Ruby Without Raising an Exception
How to Swap Keys and Values in a Hash
Bundler Not Working with Rbenv, Could Not Find [Gem]
How Does One Use Rescue in Ruby Without the Begin and End Block
How to List All Methods for an Object in Ruby
Private Module Methods in Ruby
Why Are All Rails Helpers Available to All Views, All the Time? How to Disable This