I'm trying to get my computer (Mac OS X, running Leopard) running with the latest version of Rails. Before this, I had 2.3.5. I tried following some instructions a few days ago, but didn't seem to make much progress. Now, I can't do anything in Rails. You'll see what I mean in a sec.
Theoretically, I've got the latest versions of Ruby:
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
$ sudo ruby -v
Password:
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
But if I try to run Rails, I get this error message:
$ rails testapp03
Rails requires Ruby version 1.8.7 or later.
You're running 1.8.6 (2008-08-11); please upgrade to continue.
And if I try to see which version of Rails I'm using, I get the same:
$ rails -v
Rails requires Ruby version 1.8.7 or later.
You're running 1.8.6 (2008-08-11); please upgrade to continue.
In case these are useful:
$ which ruby
/opt/local/bin/ruby
$ sudo which ruby
Password:
/opt/local/bin/ruby
$ which rails
/usr/bin/rails
So, the question: What have I done, and what do I need to do to get Ruby / RubyGems / Rails up and running on my computer?
What does which gem return?
Probably, your Ruby installation points to /opt/local/bin/ while the gem command is still referencing /usr/bin/.
When you installed the Gem, the Gem was saved in /usr/bin/ and loads the original system Ruby.
I don't know how you installed Ruby 1.8.7, however I would suggest you to take a step further: remove all your Ruby versions (except the system one, of course) and try RVM.
Try executing this command /opt/local/bin/ruby -v from the command line and see what version of ruby that come out.
Next find out where is the ruby gems is located with whereis ruby. I assume it should near /opt/local/lib/ruby-x.x/gems/.... Also try find out whether rails is installed under those directories. If not, your rails might be still pointing to the old ruby.
Also check if you have /usr/bin/ruby? If so, what is the output of /usr/bin/ruby -v ?
If it exists and rails is pointing to that version, So you should uninstall that ruby and rails, and install the rails gem all over again with /opt/local/bin/ruby
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.
I am currently following the rails guide to create a blog app.
When I run.
ruby -v #ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16].
I have already ran:
gem install rails
bundle install
I just reached step 4.1, then I ran
bin/rails server
and I am encountering the following error
It's a warning, and not an error. It's clearly suggesting: upgrade to 2.3.1
The server is up and running anyway.
If you are using rvm, rvm install ruby-2.3.1 will do it for you.
I'm really frustrated two day trying to work with rails for first time but I got many errors right now when I try to get the rails version got te next:
➜ first_app $ pwd
/Users/ChrispazDev/rails_projects/first_app/first_app
➜ first_app $ rails -v
Bundler is using a binstub that was created for a different gem.
This is deprecated, in future versions you may need to `bundle binstub rails` to work around a system/bundle conflict.
Rails 4.2.3
➜ first_app $ cd ..
➜ first_app $ rails -v
/Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/rails:23:in `load': cannot load such file -- /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/gems/rails-4.2.3/bin/rails (LoadError)
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/rails:23:in `<main>'
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/ruby_executable_hooks:15:in `eval'
from /Users/ChrispazDev/.rvm/gems/ruby-2.2.1#update3tutorial/bin/ruby_executable_hooks:15:in `<main>'
➜ first_app
Sorry if it's something stupid but I'm really lost.
Mac OS 10.10.3
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
Regards.
It appears that the install of Rails is messed up. The last error message comes from when you were at the path /Users/ChrisapzDev/rails_projects/first_app compared with the original message inside a sub-directory to this path.
Additionally notice that you have RVM installed so you may need to
Test the path that is being used for the invocation of rails using explicit ./rails -v to see what happens
Clean out the RVM Gemset rvm gemset empty
Reinstall rails in the context of the gemset you have allocated via RVM.
It is because of RVM, your ruby versions are messed ( Your system ruby, and ruby you installed with rvm). There is no need to uninstall RVM as it will help you to switch between your ruby versions.
Try using below code
rvm use system // for using system ruby
rvm use x.x.x // Here x.x.x is version of ruby
as rvm use 2.2.2
May be this tutorial will help you .
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've been fighting with my Mac OS X 10.8 installed version of Ruby and tried to move to a .rvm install in order to keep everything up to date.
After going through all the documentation on the RVM website, here are some outcomes:
~$ which ruby
/Users/localadmin/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
~$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]
~$ which rails
/usr/bin/rails
~$ rails -v
-bash: /usr/bin/rails: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
I'm not exactly sure what's causing this. I'm expecting that Rails is trying to use the system Ruby version, which isn't what I set as default in RVM.
I've read that it could be a .gemrc problem, but I can't seem to find a .gemrc file in my home directory. I can't seem to find any references to rails in my .rvm directory, so I'm thinking maybe when I did "gem install rails", "gem" was actually the one affiliated with my system Ruby.
Sorry to answer my own question, and I'd be happy if it gets deleted, but the solution was fairly annoying.
I had been installing rails with:
sudo gem install rails
I guess this took me out of the userspace in which my RVM installation sat
gem install rails
installed rails properly and now I get "Rails 3.2.9" as the outcome to rails -v
Could anyone shine any light on why this happened?
When using RVM, you pretty much NEVER use sudo for anything. The only common exception to this I've found is when installing the Passenger module.
That means all operations you want to perform on or with gems, rubies, rubygems, or RVM itself should NOT be performed with sudo.
Also make sure to do rvm use [RUBY] --default to make certain you're always using a ruby other than the system ones.