2

Is there any way to revert back to the version of RubyGems that comes with Mountain Lion? The reason I ask is that with every gem I install I receive the following warnings:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block

It doesn't seem like this causes any problems and I can always skip installing the docs. But, and call me a perfectionist, I hate receiving them. So can I either revert/downgrade to the original system Rubygems or can I get some direction on how to fix the warnings.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
tstrokes
  • 182
  • 1
  • 1
  • 8

2 Answers2

4

You are running an old version of Ruby. 1.9 has come and gone and we're now on 2.0, so you might want to consider updating your Ruby.

I will NOT recommend updating the version installed by Apple. That is there for their own purposes so leave it alone.

Instead, use either rbenv or RVM to install "sandboxed" Rubies in your own home directory, which allows you to have multiple versions installed and switch between them.

Which you choose is up to you. RVM is a bit easier if you don't want to know how your Ruby versions are installed, and it has a lot of features and is very customizable. It is also bigger and more complex. rbenv is more bare-bones and doesn't do as much, but, in my opinion, is easier to manage and understand.

If you install RVM, take the time to read the ENTIRE installation page before starting. Do NOT use the multi-user/system-wide installation; We regularly hear tales of woe from users who didn't bother to read the directions and got their Ruby partway installed but resulting in an unusable system.

Regarding upgrading Rubygems, you can always run gem update --system, but I'd recommend going the RVM/rbenv path first.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • Thanks for the suggestions. I was able to downgrade rubygems to 1.3.6. The warnings are gone. I will be installing rbenv. I like the minimal approach. Does it have gemsets like rvm? – tstrokes Jun 19 '13 at 15:19
  • No, rbenv is minimally invasive. I found I never used gemsets in several years and only used a few of the features in RVM, so I use rbenv on my desktop machine and RVM on my development host. – the Tin Man Jun 19 '13 at 16:03
2

Following the suggestion from the Tin Man, these are the steps to follow using rbenv.

Use Homebrew to install rbenv and ruby-build (a rbenv plugin for easily installing different Ruby versions) in your system:

$ brew update
$ brew install rbenv
$ brew install ruby-build

As instructed by rbenv, also add the following line to your profile (e.g. ~/.bash_profile):

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

Restart your terminal or source ~/.bash_profile before continuing.

Figure out the latest stable version of Ruby—at the time of writing it's 2.0.0-p247—and install that version:

$ rbenv install 2.0.0-p247
$ rbenv rehash
$ rbenv global 2.0.0-p247

And then you should be good to go. Remember to run rbenv rehash after installing any gems that provide commands.

Community
  • 1
  • 1
Juan A. Navarro
  • 10,595
  • 6
  • 48
  • 52