Ruby 1.9.1 & Rails 3.0: Fixing ‘Invalid .gemspec format’ and rubygem warnings

I had a lot of trouble with some rubygem warnings after upgrading to Ruby 1.9.1 and Rails 3.0 on Mac OS x Snow Leopard. They always occurred when I started the server within the project with the command

At first, when running on bundler 0.9.3, I had two types of errors. The first NoMethodError populated the terminal with hundreds lines of code, like …

The bundler-team around Carlhuda fixed that issue within bundler 0.9.4. So that problem will not occur any more.
The other problem was quite persistent. When starting the server via

or doing a test via

within the rails-3-project resulted in a bunch of warnings:

Jeremy Kemper from the Rails core team pointed out that this is not a Rails problem, but a RubyGems issue. Ruby 1.9 ships with an outdated RubyGems … like 1.9.1p378 ships with RubyGems 1.3.1. I did update RubyGems to Version 1.3.5 by

but this resulted in some duplicated rubygem files, which cause the error.

So how can the problem be solved? Deleting and reinstalling Ruby 1.9.1 does not have any effect … but the solution is quite simple:

If you already installed Ruby 1.9.1 and Rails 3.0 beta:

1. Be sure that you do NOT install RubyGems 1.3.5 separately after the installation of Ruby 1.9.1 – this would result in a double installation. So have that in mind when following the excellent instructions to installing Ruby, RubyGems, and Rails on Snow Leopard of Dan Benjamin.

2. If you already installed Ruby 1.9.1, updated to RubyGems 1.3.5 and bundler 0.9.4 and also installed Rails 3.0, the only thing you have to do is:

That’s it. No errors any more!

If you did not install Ruby 1.9.1 and Rails 3.0 yet …

1. You may start with Dan Benjamin’s recipe and modify it so you download, make and install the ruby-1.9.1-p378.tar.gz but NOT the rubygems-1.3.5.tgz.

2. Then update RubyGems with the command

3. Ensure that the rake and the sqlite3-ruby gems are installed, too.

4. Now install the needed gems and rails –pre as described in the Rails 3.0 beta release notes

5. After the successful installation of Rails 3.0 beta, you now have to do the vitally important step:

6. Finally check, if any gem needs an update before diving into Rails 3.0 by

Hope this helps … and saves some time. Thx Andy for the hint ;-)

m4s0n501

5 Comments

  1. I am running Ruby 1.9.1 on RVM on my Ubuntu Karmic workstation. When I attempt to gem uninstall rubygems-update, I get the following error:

    ERROR: While executing gem … (Gem::InstallError)
    cannot uninstall, check gem list -d rubygems-update

    gem list -d rubygems-update yields this:

    rubygems-update (1.3.5)
    Authors: Jim Weirich, Chad Fowler, Eric Hodel
    Rubyforge: http://rubyforge.org/projects/rubygems
    Homepage: http://rubygems.rubyforge.org/
    Installed at: /home/anthony/.rvm/gems/ruby-1.9.1-p378%global

    RubyGems is a package management framework for Ruby

  2. I had the exact same problem.

    With RVM, the problem is the original Ruby system installation. So you have to switch before you uninstall the “rubygems-update” gem.

    $ rvm system
    $ gem list -d rubygems-update (just to confirm location is /Library/Ruby/Gems/1.8)
    $ sudo gem uninstall rubygems-update

    Problem solved.

  3. that issue seems to have gone with ruby-gems1.3.6: I had the very same warnings with rvm/rails1.91 and an update with gem update –system also got rid of the warnings.

  4. I had a similar issue running rake cucumber, gem update

  5. Im having the same problem as Brett above. Though it’s not going away after “bundle install”. Gemfile:

    source ‘http://rubygems.org’
    gem ‘rails’, :git => ‘git://github.com/rails/rails.git’
    gem ‘pg’
    gem ‘mysql’
    gem ‘haml’
    gem ‘compass’

    # Cucumber on Rails 3 http://github.com/aslakhellesoy/cucumber-rails/blob/master/README.rdoc

    group :test do
    gem “rspec-rails”, “>= 2.0.0.beta.1″
    gem “factory_girl_rails”
    gem ‘autotest’
    gem ‘capybara’
    gem ‘database_cleaner’
    gem ‘cucumber-rails’
    gem ‘cucumber’
    gem ‘spork’
    gem ‘launchy’
    gem ‘webrat’
    end

    gem “rails3-generators”, :git => “git://github.com/indirect/rails3-generators.git”

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">