How do I fix broken gems in Leopard?

/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

This is what I get when I try to run anything like “sudo gem update

I tried to upgrade my 1.2.6 rails install running on Leopard. I think
the problem started because I forgot to run my “gem install rails”
command (to upgrade to 2.0) using “sudo”. That and I forgot to use
“update” instead of “install” - so things are a bit crazy now.

I can run rails and the version in the Terminal is 2.0.1 - but when I
am getting a MySQL related error when I try to view the application’s
framework. I thought I might need to update my gems, so I downloaded
the latest package and ran “ruby setup.rb”. I also made sure that the
mysql gem was up to date. Now nothing related to gems is working.

I’m new to rails and I’m used to the whole “it just works” mentality
of developing on a Mac. So I really don’t know where to begin when
I’m troubleshooting rails.

How do I make sure that my gems are properly installed and reinstall
them if I need to? And on that note, does anyone know where all the
gems are kept in Leopard? I found references to them in /Library/Ruby/
1.8/Gems and /System/Library/Frameworks/ruby.framework

Once I do that, is it possible to roll back to rails 1.2.6 so I can
get a stable environment again before trying to upgrade to 2.0 again?

Thanks for any help you might be able to give.

shirt wrote:

/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

Once I do that, is it possible to roll back to rails 1.2.6 so I can
get a stable environment again before trying to upgrade to 2.0 again?

Thanks for any help you might be able to give.

hmmm. Leopard?
give me the Mac, and I will give you a Linux box?

i will figure it out on the mac, and will tell you what to do on ubuntu

deal? sign here:


(nobody shoot me!)

need my mailing address?

I think you went wrong by installing gems the way you did.

Go to macosforge under the Ruby section and find the FAQ.

On Dec 14, 12:57 pm, “gemblon (t.b.)” <rails-mailing-l…@andreas-

Eureka! All I had to do was take the latest gems and run “sudo ruby
setup.rb” again. it copied over all the other gems (that I guess had
the wrong permissions) and now I can run “gem” scripts again. I’m
still having issues with the upgrade to 2.0 though, any ideas about
how I might be able to downgrade to 1.2.6, then try again?

Thanks, I’ll look into that.

I’m not at my system right now but I think you’ll need to update gem
to the current (0.9.?) version before going to rails 2.0.1

sudo gem update -system

Then just

sudo gem install rails

I think the gem update command is correct, but if it errors, check the
rails site for the correct command.



:slight_smile: Very funny. I love my Mac. It’ll take a lot more than a broken
set of gems to make me give it up.

On Dec 14, 12:57 pm, “gemblon (t.b.)” <rails-mailing-l…@andreas-

Well I think I did the exact same thing… And then it dawned on me
that in creating that new rails app that I didn’t go into mysql and
create any databases for it, so checking the app properties ran into a
problem:-) slapped my head, created a -development database and the
all was fine.



Thanks, Jim. (BTW, it’s “sudo gem update --system” with two
hyphens. But I got the idea, I just ran help to find the correct

I was pretty sure that I already had 0.9, but I went ahead and updated
it then installed rails again. Still the same problem. After
creating a new rails project, I bring up localhost:3000 and check the
info about the application’s environment and I get this:

Mysql::Error in Rails/infoController#properties

followed by this:

connection_adapters/mysql_adapter.rb:471:in real_connect' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.1/lib/active_record/ connection_adapters/mysql_adapter.rb:471:inconnect’
connection_adapters/mysql_adapter.rb:165:in initialize' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.1/lib/active_record/ connection_adapters/mysql_adapter.rb:88:innew’
connection_adapters/mysql_adapter.rb:88:in mysql_connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.1/lib/active_record/ connection_adapters/abstract/connection_specification.rb:291:insend’
connection=' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.1/lib/active_record/ connection_adapters/abstract/connection_specification.rb:259:inretrieve_connection’
connection' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.1/lib/active_record/ query_cache.rb:8:incache’
caching.rb:677:in perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.1/lib/action_controller/ base.rb:524:insend’
base.rb:524:in process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.1/lib/action_controller/ filters.rb:685:inprocess_without_session_management_support’
session_management.rb:123:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.1/lib/action_controller/ base.rb:388:inprocess’
dependencies.rb:489:in load' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.1/lib/active_support/ dependencies.rb:489:inload’
dependencies.rb:342:in new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.1/lib/active_support/ dependencies.rb:489:inload’
dependencies.rb:496:in require' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.1/lib/active_support/ dependencies.rb:342:innew_constants_in’
dependencies.rb:496:in `require’

Any thoughts?


I wrote an entry on my blog about this, fairly simple fix:

open a terminal
sudo emacs /usr/bin/gem

then add the line require ‘rubygems/gem_runner’ as so:

deps = %w(actionpack activerecord actionmailer activesupport
require ‘rubygems’
require ‘rubygems/gem_runner’

Why don’ you just leave the Leopard files alone, and use Macports.

I never touch anything in /usr/ (/usr/lib) actually…

Just use macports.
Everything goes to /opt/local/

you have to add this to your ~/.bashrc or ~/.bash_profile

export PATH=/opt/local/bin:/$PATH

I NEVER had a single issue since the 1st day I have my MACBOOK. Which
is about 1 year from now, and I work with ruby/rubygems everyday.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs