Why do I get "conflicting chdir during another chdir block" when updating Rubygems on Mountain Lion?

10,661

Solution 1

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.

Solution 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.

Share:
10,661
tstrokes
Author by

tstrokes

Updated on June 05, 2022

Comments

  • tstrokes
    tstrokes almost 2 years

    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.