4
votes

For some reason everytime I reboot my computer I have to redo a lot of Ruby on Rails setup. I have to redo the "bundle install" to install all of the gems in my Gemfile, and then I have to reinstall rails with "gem install rails" even though I installed rails through RVM. I have never had this issue on another computer with other setups so I'm not sure what is going wrong.

Below is some terminal output that will hopefully help someone debug what is going wrong.

$ rails

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

$ rvm -v

rvm 1.10.2 by Wayne E. Seguin , Michal Papis [https://rvm.beginrescueend.com/]

$ rvm info

ruby-1.9.2-p290@demoapp:

system: uname: "Darwin Jonathans-Mac-Pro.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64" bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)" zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"

rvm: version: "rvm 1.10.2 by Wayne E. Seguin , Michal Papis [https://rvm.beginrescueend.com/]" updated: "11 hours 11 minutes 19 seconds ago"

ruby: interpreter: "ruby" version: "1.9.2p290" date: "2011-07-09" platform: "x86_64-darwin11.2.0" patchlevel: "2011-07-09 revision 32553" full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"

homes: gem: "/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@demoapp" ruby: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290"

binaries: ruby: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290/bin/ruby" irb: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290/bin/irb" gem: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290/bin/gem" rake: "/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@demoapp/bin/rake"

environment: PATH: "/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@demoapp/bin:/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/joncalhoun/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" GEM_HOME: "/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@demoapp" GEM_PATH: "/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@demoapp:/Users/joncalhoun/.rvm/gems/ruby-1.9.2-p290@global" MY_RUBY_HOME: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290" IRBRC: "/Users/joncalhoun/.rvm/rubies/ruby-1.9.2-p290/.irbrc" RUBYOPT: "" gemset: "demoapp"

$ gem -v

1.8.16

$ gem which (this doesnt returns anything oddly)

After I gem install rails: $ rails -v

Rails 3.2.1

I am guessing this is something wrong with my gem setup but I don't know enough to know where to dig. If you need any more information to help I can provide it and thank you for anyone who has the time to help.

1
What is the precise commands that you're using to install rails?Ryan Bigg
More specifically, when you installed rails, did you sudo gem install it or did you do a gem install. Since you are using single user rvm, you should have done a gem install rails, not sudo...Marc Talbot
@MarcTalbot I didn't use sudo. I have read that can cause issues with RVM. Specifically I used this guide when installing: ruby.railstutorial.org/chapters/beginning?version=3.2joncalhoun

1 Answers

3
votes

If you're using Rails 3.2.1 with RVM, you usually do not need to run 'gem install' manually.

My guess is, you've installed ruby interpreter via RVM (or possibly, you haven't installed ruby in RVM), or you haven't configured RVM to select the default ruby interpreter.

You can configure default ruby by (if you're using 1.9.3-p0):

rvm 1.9.3-p0 --default

Then, the 1.9.3-p0 ruby will in effect after logging in to the shell. You can check which ruby interpreter is in use, by:

which ruby

If you correctly configured, it should be print like:

{your-home-path}/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

In the post bundler-age rails app, you just need to run bundler to install required gems (onto the current gemset in RVM). If you don't create gemset, global gemset will be used. Run:

bundle

will install all gems you need.

Now, since RVM automatically select 1.9.3-p0 with gemset named 'global', you don't need to re-install after boot (as I do).

You can optionally create gemset for the rails app and configure per-directory basis. To configure default gemset/ruby interpreter per application, check the RVM site.