Benjamin Juang (ibneko) wrote,
Benjamin Juang

Setting up system-wide RVM and Passenger on MacOS X

I wanted system-wide RVM. The idea of having RVM install different version of ruby into my home directory strikes me as a bit odd.

Anyways, I also ran into problems with getting Passenger to install - somewhere along the steps of getting RVM installed, then Ruby 1.9.1, I messed up the gem paths or used sudo when I shouldn't have used sudo. So I had problems running passenger-install-apache2-module. I kept getting the error:

/usr/lib/ruby/1.8/rubygems.rb:636:in `report_activate_error': Could not find RubyGem passenger (>= 0) (Gem::LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:141:in `activate'
from /usr/lib/ruby/1.8/rubygems.rb:49:in `gem'
from /usr/bin/passenger-spawn-server:18

gem list said it was installed.
However, I discovered that Gem.path was terribly messed up and didn't match gem env at all. When running

$ ruby -r RubyGems -e "p Gem.path"

I got really strange path that had 1.9.1 in it, despite having 1.9.2 installed.

$ gem env
- /usr/local/rvm//gems/ruby-1.9.2-p0
- /usr/local/rvm//gems/ruby-1.9.2-p0@global

Anyways, in the end, I used a combination of:

$ Sudo su
first, to get into a root shell, followed by
$ bash

Then I followed the normal installation steps - that installed rvm into /usr/local/rvm

Created /etc/rvmrc:
# Setup default configuration for rvm.
# If an rvm install exists in the home directory, don't load this.'
if [[ ! -s "\$HOME/.rvm/scripts/rvm" ]]; then
umask g+w
export rvm_selfcontained=0
export rvm_prefix="/usr/local/rvm"
export rvm_path="/usr/local/rvm"

Added the following to /etc/profile:
# Load RVM if it is installed,
# first try to load user install
# then try to load root install,
# if user install is not there.
if [ -s "$HOME/.rvm/scripts/rvm" ] ; then
. "$HOME/.rvm/scripts/rvm"
elif [ -s "/usr/local/rvm/scripts/rvm" ] ; then
. "/usr/local/rvm/scripts/rvm"

Added the following to ~/.profile
export rvm_path="/usr/local/rvm"
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.

  • Bah, stupid rain...

    So I went to UIUC this weekend to watch the J-net fashion show and hang out with friends there. Friends == quite good fun, although people are…

  • PuzzleCrunch 2008!

    It's short notice, but we wanted to inform everybody who participated in the last PuzzleCrack that we will be holding PuzzleCrunch this Saturday,…

  • Yay! J-net's Japan Night is over.

    It was pretty awesome, although we lost money, since we only got half of our target audience- 180-something, instead of 400. That was relative fun…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded