Ruby RVM issues - ruby

So I think* RVM may be keeping my Ruby version back artificially. I am getting all sorts of errors in Rails. So I checked the Ruby version I was using. Said it was back a few versions.. so I tried updating to 2.5.0. System said 2.5.0 was already installed? So I checked ruby -v, and got 2.3.3
Here is exactly what my system is telling me:
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ brew install ruby
Warning: ruby 2.5.0_2 is already installed
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
Johns-MacBook-Pro:PLAYGROUND johnseabolt$
I thought it was an RVM issue maybe? But when I tried to use 2.5.0, I got this:
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ rvm use 2.5.0_2
Required ruby-2.5.0_2 is not installed.
To install do: 'rvm install "ruby-2.5.0"'
Any ideas what is going on? It's a bit of a pain.

This is the relevant line of output:
To install do: 'rvm install "ruby-2.5.0"'
what happens when you run that line of code? It should fix all your problems... :)

I'm not sure what you're saying your problem is exactly, but you can and will have multiple versions of Ruby installed in various places on a modern system. Different applications will require different versions.
In terms of being held back, Ruby doesn't autoupdate like browsers, it's up to you to install the ones you want.
It looks like you have at least one Ruby installed with RVM, and you may have installed with Brew too (which I didn't you know you could do, but I would recommend not to do)
which ruby will tell you which Ruby is loaded in a new shell. It should be in an RVM bin.

Related

Older Ruby Version Showing After Installing Latest One | rbenv and zsh

I need some assistance with installing rbenv and Ruby 2.6.6. I'm currently using zsh, I want to install Ruby 2.6.6, so I did the following:
brew install rbenv
rbenv install 2.6.6
rbenv global 2.6.6
After I did this, I restarted the terminal and I performed the following statement to check the ruby version:
ruby -v
However, the ruby version states:
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I've tried restarting my terminal and repeated the same steps. I'm new to programming, just need your assistance in helping me fix my setup issues.
Thank you so much for your help
It looks like this is picking up your system Ruby, not the rbenv installed one. You can confirm that with which ruby, which should not say /usr/bin/ruby but something like /Users/<your account/.rbenv/bin (or similar, I don't use rbenv myself anymore). You need to configure your $PATH to make sure this comes before /usr/bin.
The command rbenv init should have taken care of this. If you didn't run it, do that. You can also perform the necessary steps manually, see the documentation for that.

RVM - Do I need Ruby 1.8.7 in order to install Ruby 1.9?

I just need some clarification on a line I read after running rvm requirements. It says
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you
must install and use rvm 1.8.7 first.
Does this mean RVM version 1.8.7 or Ruby version 1.8.7? I'm currently running RVM version 1.10.2 with no gems installed, but I want to only install 1.9.3. Thanks!
Just looking at the most recent revision of that part of RVM, it seems like you get that message automatically. It's targeted at *nix users so I can't check it currently, but all such users should get that message from rvm requirements. It's been there since last September, and it's not a warning that you haven't met a dependency. (Note that it also says bash, curl, git and patch are required, and you likely have those, too.)
In any case, it's referring to the RVM version, which for you is two minor versions ahead. It's an understandably confusing message as 1.8.7 is also a fairly widespread version of Ruby.
This means RVM version 1.8.7, not Ruby 1.8.7.

What is the point of installing the same version of Ruby through RVM as the system Ruby?

I've been using the default system ruby version 1.8.7 without RVM for a few rails projects and have not run into any problems. I just recently installed RVM, and after running rvm requirements I get this output:
To use an RVM installed Ruby as default, instead of the system ruby:
rvm install 1.8.7 # installs patch 357: closest supported version
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems
rvm alias create default 1.8.7
I believe what these commands do are to install the same gems that have already been installed using the system ruby under the RVM installed ruby.
My questions are, am I right in what these commands do? and if I am right, why is it important to do this, because if I wanted to use an RVM installed Ruby of a different version like 1.9.2, wouldn't it already separate gems in that version from the system's ruby?
The one thing that springs to mind is, if you use the system Ruby, you'll use it slightly differently that RVM's Rubies--for example, you'll likely need to use sudo to install gems. Furthermore, you won't be able to use many of RVM's features, like gemsets, with the system Ruby.
Well one reason I can think of is that you don't wanna worry about your system not working even if the system ruby gets updated.
My questions are, am I right in what these commands do?
You are right in what they do. The first command installs Ruby 1.8.7, the second command installs all the gems currently install on your system Ruby installation in the new RVM Ruby 1.8.7 installation, and the third command sets your default version of Ruby to be the RVM Ruby 1.8.7.
and if I am right, why is it important to do this, because if I wanted to use an RVM installed Ruby of a different version like 1.9.2, wouldn't it already separate gems in that version from the system's ruby?
The second command is actually more of about convenience than necessity. Yes, the gems install in the RVM 1.8.7 will be completely separate from the ones installed in the system version of Ruby; however, if you didn't run the second command, you're RVM 1.8.7 would start out with almost no gems (only the defaults). That means that you would need to go through and manually install the gems that you need to get your project up and running. Instead of doing that, the second command allows you to just install the same gems you've already installed in the system version of Ruby to the RVM 1.8.7 version—it doesn't migrate them, it just makes a copy of them. After the second command, there are two distinct sets of the exact same gems: one in the system Ruby and one in the RVM 1.8.7 Ruby. So, if you were to update gems in either of the Rubies, they would get updated, but the other version's gems would be unaffected.
Hope this helps answer your question.

Did ruby install wrong?

I followed 2 different guides to install ruby on OSX and I think I messed some things up. Now that I know what I'm doing a bit more I have a feeling something is wrong. I'd like to 'start fresh' but i dont know what to remove safely (I dont mind re-installing everything. I have nothing super important)
I first used rvm and then decided i wanted to use homebrew. I uninstalled rails with rvm and then 'imploded' rvm. I then installed homebrew and then brew install rails 1.9.3
Although... when i run gem install xxx, all my gems seem to be in a weird path?
For instance, sinatra.rb is installed here:
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib
Notice it says 1.9.1, yet when I run
ruby -v
I get 1.9.3p0
and which ruby i get this
/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby
If i do which [rails,git,mysql,whatever]
they all seem to point to Cellar.
as a sidenote, i have two versions of sinatra.rb on my computer... this is where the other one is (although the one I'm pretty sure it's not using).
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/sinatra-1.2.0/lib
kind of ridiculous...
I'm not sure whats going on here.
This is my path if that helps:
export LSCOLORS="GxGxBxDxCxEgEdxbxgxcxd"
export CLICOLOR=1
export PATH=/usr/local/Cellar/ruby/1.9.3-p0/bin:/usr/local/mysql-5.5.18-osx10.6-x86_64/bin:/usr/local/bin:$PATH
That's fine. You are using 1.9.3. The gems are installed under a 1.9.1 directory, to distinguish them from gems installed for 1.8.7 (some gems that work with the 1.9 series don't with 1.8, and vice-versa). 1.9.1 was the first released version of the 1.9 series.

problem with installing ruby 1.9.2 on OS X 10.6.8

i am new to Mac and Ruby on Rails. so, please do understand me if i am posting a dumb question. but, i have been struggling with this problem for a few days with no progress, so i really need some help.
i installed ruby 1.9.2 with RVM. but, when i type "ruby -v" command after installation, it says that the ruby version i have is 1.8.7. so, i have tried "rvm use 1.9.2" command, but it still says my ruby version is 1.8.7. i even re-installed ruby 1.9.2 using RVM a few more time, but no luck. when i typed "rvm list", it says ruby-1.9.2-p290. does that mean my rvm did install ruby 1.9.2, but for some reason, i cannot even get my RVM switch to ruby 1.9.2 from ruby 1.8.7?
what can i do to use ruby 1.9.2??
[added on Aug. 15th] By the way, I just type "rvm info", and it says "ruby-1.9.2-p290" and then all the other stuff explaning. Does that mean that my rvm already has switched ruby to 1.9.2??? But, then, why "ruby -v" keeps saying ""ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]"???
You're probably using a different rvm set when u open terminal..
Since OS X doesn't come with Ruby 1.9.2.., you are being defaulted to the system installation of Ruby.
CLICK FOR LINK :):)
Check out this link to learn how to set a default Ruby version.
I am writing an answer to my own question for anyone with the same problem that I've suffered!
The problem was with "rvm"!
I updated rvm instead of removing it (in some cases, it would be a good idea to completely remove rvm from your system, and re-install it). I followed rvm instructions: http://beginrescueend.com/rvm/install After updating rvm, I was able to install Ruby 1.9.2(!!), and the problem with
"rake" command was gone!!!
I should have suspected rvm sooner, then I wouldn't have wasted one week!
PS Try avoid using sudo when it is not necessary when installing. Someone mentioned that he/she used "sudo" to install when he/she didn't have to, and it just created the same problem as I was having!

Resources