Is it possible to downgrade RVM version without uninstalling? - ruby-on-rails

I have two servers that are running (almost) identical installs. Both servers are VMs and server_b was created as a copy of server_a (this is how I know they are identical installs). Server_a has since been updated using 'rvm get HEAD'.
server_a:
rvm version 1.15.4
ruby-1.8.7-p334
.rvmrc file specifying ruby-1.8.7#my_gemset (no patch level specified)
Rails 3.0.5
server_b:
rvm v 1.2.8
ruby-1.8.7-p334
.rvmrc file specifying ruby-1.8.7#my_gemset (no patch level specified)
Rails 3.0.5
When I deploy to server_a, RVM complains that ruby-1.8.7-p370 is not installed, but deploying to server_b does not generate this error. I'm not sure why it is looking for the latest patchlevel for 1.8.7 -- I have gone through the RVM configs on each server, comparing them. (The output from 'rvm info' results in the same information from both servers, other than the RVM version).
I've come to the conclusion that it might have to do with the version of RVM? Have I missed something obvious? Any suggestions would be greatly appreciated.

you should rather update then downgrade, you real problem is that you specify ruby version without patchlevel, in this case RVM will take the latest known patchlevel, so instead of rvm use 1.8.7 you need to tell it rvm use 1.8.7-p334.
As for the downgrade question you can specify version rvm get 1.2.8, just keep in mind this version is about 2 years old, a lot of things was fixed in rvm since then, and you will not get any support for the old version.

yes it is possible. You can do it.
Previously i was using rvm version 1.29.0
I tried with this code to use rvm with the version of 1.28.0
Code is : rvm get 1.28.0

Related

I get a bash error message when I run "bundle install" after re-installing ruby

I removed the previous version of ruby I installed, ruby 1.9.1 to be precise, on my Ubuntu, and installed version 2.2.3. When I try to run bundle install on my terminal, I get this error
bash: /usr/local/bin/bundle: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory.
Can anyone advice on how to fix it?
How did you remove the old version of Ruby?
It looks like it left the binary executable for bundler, so I'm guessing you just straight up deleted the usr/bin/ruby folder? Ruby installations (and most installations) tend to create executable binaries in other folders that need to be deleted as well.
I would highly recommend that you use something like rvm or rbenv to manage multiple versions of ruby on your system. Those tools are designed to do that sort of thing and are basically industry standard at this point.
My personal recommendation is rvm, although either is really fine. If you choose to go with that, check out rvm.io for installation instructions.
It'll install rvm with the latest ruby version. In addition to that you are free to install any other version of ruby or patch that you prefer, and you can easily switch between the two using rvm use <ruby version>

Ruby on Rails Mac OSX Mavericks issues after RVM install

I have been learning Ruby on Rails for a couple of months, and everything was working.
Then, for the needs of a tutorial, I tried to install RVM, in order to downgrade my setup to older versions of Ruby and Rails.
And since then, I kept running into troubles.
For instance, anytime I launch a new Terminal session, here is what I get:
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /Users/Thibaud/work/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
ree-1.8.7-2012.02 - #gemset created /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02#tedxperth
ree-1.8.7-2012.02 - #generating tedxperth wrappers....................
Using /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02 with gemset tedxperth
Warning! Executable 'ruby' missing, something went wrong with this ruby installation!
Warning! Executable 'gem' missing, something went wrong with this ruby installation!
Warning! Executable 'irb' missing, something went wrong with this ruby installation!
Two questions:
How can I resolve the errors appearing in my Terminal? (see above)
Since I do not know what got broken in my install, I am wondering whether I should unsintall the whole Ruby on Rails environment and set it up again to get a clean install: Is this a good idea? If so, how can it be achieved?
Your first set of errors will go away if your remove the hidden .rvmrc file in your project directory:
$ rm .rvmrc
The file only exists to set a Ruby version and gemset when you cd into the directory. You can either set the Ruby version and gemset manually, or create new .ruby-version and .ruby-gemset files which are compatible with RVM and other version managers. For details, see my answer Use rvmrc or ruby-version file to set a project gemset with RVM?.
You may need to remove and reinstall the Ruby version you are using. Here's how:
$ rvm remove ree-1.8.7-2012.02
Here's the documentation.
You probably don't need to uninstall RVM. But if you do, you can use
$ rvm implode
to remove all traces of RVM before re-installing (documented here). For more details on installing Ruby and multiple versions of Rails using RVM, see the article I wrote:
Install Ruby on Rails - Mac OS
X
Lastly, since you mention that you are reading a tutorial that requires an old version of Rails, may I politely suggest you have a look at a book I've written for beginners that is up to date with the newest version of Rails (currently Rails 4.1 but I revise the book with every new release). I hope it is helpful:
Learn Ruby on
Rails
I mention my article and my book because they provide additional information about setting your development environment for Rails using RVM and may answer further questions for you.

Ruby version did not get updated to 1.9.x

I installed ruby as per instructions given here but when I do ruby--version then it still shows 1.8.7. How do I make sure I use newly installed Ruby?
I would suggest you to use RVM (Ruby Version Manager). You may find a full installation guide here:
http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/
If you get an error such as "ERROR: Error running ' ./configure...." after executing rvm install e.g.
rvm install 1.9.3
Then you may try to install it like this:
rvm install 1.9.3 --with-gcc=clang
Note: in the guide this possible error is not described
Did you properly setup your PATH? What's the output of echo $PATH? /usr/local/bin has to come first they way this tutorial sets up things. You see that everything worked right when which ruby displays /usr/local/bin/ruby.
Personally I'd recommend using a tool for managing Ruby versions though. RVM still seems to be the most popular choice, I prefer the combination of rbenv and ruby-build.

Would it be worth migrating a ruby install to RVM?

Several months ago, I installed ruby 1.9.1 on Mac OSX 10.6 using the instructions here, modified for the newer versions of ruby/rails/gem.
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/
A project has now come up where I need to develop a site using an older version of rails, and consequently, an older version of Ruby. I've successfully installed RVM, older versions of gem and the rails gems, but now I'm mildly worried about my environment. Technically, I have 3 groups of Ruby installs floating around - the native 1.8.7 that was included with OSX 10.6, my own 1.9.1 installed in /usr/local/, and 1.8.7 in RVM.
I'm concerned that this could cause strange, difficult to diagnose errors in the long run. Would it be worth the trouble of uninstalling my 1.9.1 /usr/local and/or the baked-in 1.8.7, and installing them in RVM?
All the Rubies you use for development should be under rvm (or rbenv, as John comments). It avoids the headaches you describe--nothing more exciting than having a surprising library pulled in.
While I have removed the system Ruby on some OS X machines and not been affected by it, the Tin Man's point about not removing it outright seems reasonable, and rvm makes it unnecessary to do so. Some tools, like brew, rely on having a Ruby available; if you do remove it, you'll need to make sure that everything the system Ruby had is still available to prevent breakage.
RVM also supports the use of its own and the system ruby interchangeably. I've made use of that before, but I also agree with Dave, in that you should probably just move into the RVM world, it won't take much more effort and gives much in return.
ryanmt#Hermes:~$ rvm use system
Now using system ruby.
ryanmt#Hermes:~$ rvm use default
Using /home/ryanmt/.rvm/gems/ruby-1.9.2-p290
I'd propose a halfway house - install the other rubies in RVM and test the apps running under those with the RVM rubies? If they work, then move completely over the RVM. If they don't, you haven't lost anything, just don't use RVM for those apps. You don't need to uninstall the originals to do this.
Don't remove Apple's Ruby, but do install RVM. You probably should remove the one in /usr/local.

Ruby & Rails installation on a Mac

I used railstutorial.org to install the latest version of ruby and the latest version of rails on my machine.
at the end of the installation I checked
ruby -v ==> 1.9.2 (great)
rails -v ==> 3.0.1 (great)
this morning I opened up terminal
ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
rails -v
Rails 1.2.6
what happened?
My advice for people who are installing ruby is to use RVM. It makes managing your ruby versions and gem versions really simple and you can install multiple ruby versions side by side.
You might want to read this post:
http://rubylearning.com/blog/2010/12/20/how-do-i-keep-multiple-ruby-projects-separate/
You can use Cinderalla to the whole ruby/rvm/mysql/redis/git/... stack set up properly. Cinderella installs everything in ~/Developer and fixes up your PATH as well. I had some issues with a corrupt git mirror last time I used Cinderalla though so YMMV.
With many unix variants, you are likely to have multiple versions of Ruby--particularly if you installed Ruby 1.9 and the system already had 1.8 installed. Essentially, the 1.8 version of Ruby has a higher precedence in your PATH than the 1.9 version. The Ruby Gems command keeps the libraries separate between 1.8 and 1.9 so that the platform will be reasonably stable.
To correct the problem, you have to find where ruby 1.9 is installed. Once you do that, you'll need to override your PATH variable. Assuming 1.9 is installed in the path: /opt/ruby-1.9.2, you will need to set your PATH like this:
PATH=/opt/ruby-1.9.2/bin:$PATH
export PATH
To make the path respect what you want every time, add that to your ~/.profile file (create it if necessary). Once the path has been set, it sould be able to find the correct version of Rails again.
I cannot say for certain because I cannot debug you OSX machine from here, however, I had a very similar occurrence. The problem was caused because I had installed ruby and then rails on my machine using sudo or from the root account. Then when I discovered rvm I installed everything in my user account. When I logged off and back in I appeared to lose everything. I was pulling out my hair. I was pissed that I was going to have to reinstall everything again... when I found the magic.
from the command line execute the command:
rvm list
you'll see that your new version of ruby is there. you'll also notice the tokens that indicate that it is just a normal version. It is not current or default. (see it yet)
Now if you run the command:
rvm use 1.9.2 --default
then every time you login/off and restart your machine your user account will default to that version of ruby and all of the gems that you installed against that version.

Resources