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.
Related
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.
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.
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!
I've done some searching online and tried a few things with no luck.
I compiled Ruby 1.9.1 on a Mac that had previously been running 1.8.7.
How can I now either reinstall the gems, or point. Rubygems installs to the old location, but 1.9.1 is looking elsewhere. I've tried making a 1.9.1 (and 1.9) gems directory as a symlink to the old directory, but that doesn't seem to work. I've tried setting GEM_HOME and GEM_PATH but again no luck.
How can I find out where the current version of ruby is searching for gems at runtime, and alter it? And/or, how can I instruct rubygems to install gems where the latest version is looking for the gems.
You should either use a rvm, as was suggested, or install ruby 1.9.2 to /opt/ruby (configure --prefix=/opt/ruby --enable-shared) or /usr/local or /usr/local/ruby. Then put this path first in your PATH, before everything else. You'll have to reinstall gems anyway, as some of them are incompatible (built for 1.8.7).
It would be a good idea to install rvm and let it wrangle your Ruby versions and gems for you.
Also, you should probably upgrade to 1.9.2, as it's much more stable. 1.9.1 is basically a buggy development version of 1.9.2.
I'm working on a project that i have to use ruby 1.8.7. I'm using today, ruby 1.8.6 + Mac OSX Darwin. This ruby 1.8.6 was installed with the OS, it's a developer package from Apple. My question is: how can i update this package? if i run ports, it dont find my current installed package and install a new ruby version, with different paths and as effect it breaks my rubygems (i know how to fix it, but it is always workarounds over workarounds).
There is a clean way to update the default ruby that comes with the OS or its better to remove it and just manage it by Port? Please answer like this one How to update to Ruby 1.8.7 don't helps me
Have you tried rvm gem? It manages Ruby versions installed, allow to compile most (if not all) actual (and archival) Ruby versions, sets proper environment variables pointing to actually used ruby version.
$ gem install rvm
$ rvm install 1.8.7
$ rvm use 1.8.7 --default
On my OS X machines I have several versions of Ruby installed.
I install then, from source, under /usr/local/ruby-1.X.X
Once you have multiple versions of Ruby installed you will need your environment to know which one to use.
I do this by setting the PATH, like so
export PATH="/usr/local/ruby-1.8.7/bin:$PATH";
See Hive Logic's article on installing Ruby