This project is archived and is in readonly mode.

#3863 ✓duplicate
Ognen Ivanovski

Rails 3.0.0.beta / rake seems not to work well with rubygems 1.3.5 on ruby 1.9.1

Reported by Ognen Ivanovski | February 5th, 2010 @ 03:42 PM | in 3.0.2

Rake gives me output like it doesn't understand .gemspec files when trying to run

$ rake -T

On a newly generated rails3.0.0.beta app.

The output is in the attachment.

leto:rails oivanovski$ ruby1.9 -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10]

leto:rails oivanovski$ rake --version
rake, version 0.8.7

leto:rails oivanovski$ gem1.9 --version

Comments and changes to this ticket

  • MOE

    MOE February 6th, 2010 @ 06:20 AM

    Worked for me with no err with

    moe@ingrid:/tmp/tryout$ ruby -v
    ruby 1.9.1p243 (2009-07-16 revision 24175) [i486-linux]
    moe@ingrid:/tmp/tryout$ rake --version
    rake, version 0.8.7
    moe@ingrid:/tmp/tryout$ rails -v
    Rails 3.0.0.beta
    moe@ingrid:/tmp/tryout$ gem -v
    moe@ingrid:/tmp/tryout$ rake -T
    (in /tmp/tryout) rake about # Explain the current environment
    (blah blah)

  • José Valim

    José Valim February 6th, 2010 @ 10:06 AM

    • Assigned user set to “Yehuda Katz (wycats)”
  • José Valim
  • trevor

    trevor February 6th, 2010 @ 07:49 PM

    I posted the same problem for ticket 3865.

    % ruby -v
    ruby 1.9.2dev (2010-02-03 trunk 26544) [x86_64-darwin10.2.0]
    % rails -v
    Rails 3.0.0.beta

    seeing a lot of warnings along the lines -

    WARNING: #<NoMethodError: undefined method '>' for nil:NilClass>
    WARNING: Invalid .gemspec format in '/usr/local/lib/ruby/gems/1.9.1/specifications/warden-0.9.0.gemspec'
    WARNING: #<NoMethodError: undefined method '>' for nil:NilClass>
    WARNING: Invalid .gemspec format in '/usr/local/lib/ruby/gems/1.9.1/specifications/xml-simple-1.0.12.gemspec'


    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14: warning: already initialized constant VERSION
    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14: warning: already initialized constant RubyGemsVersion
    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:194: warning: already initialized constant MUTEX
    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:196: warning: already initialized constant RubyGemsPackageVersion
    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:202: warning: already initialized constant WIN_PATTERNS

    whenever starting rails with rails server or rails console

  • Balazs Nagy

    Balazs Nagy February 7th, 2010 @ 02:40 PM

    I'm hunting this problem for a while too. Apparently it's fixed in bundler (instead of pointing to one other), in

    The problem is with multiple require of 'rubygems'. For the other, direct rubygems warnings, I have written the same patch for active_support. Oh, good ol' days of

    #ifndef WHATEVER_H
    #define WHATEVER_H
  • Balazs Nagy

    Balazs Nagy February 8th, 2010 @ 02:03 PM

    Hmm my bad. The problem lies in ruby itself:

    ike:~>>% ruby -e 'puts $".grep(/rubygems/).inspect'

    The pattern is .../lib/ruby/<version>/rubygems.rb. However, 1.3.5 is installed in another directory like .../lib/ruby/site_ruby/<version>/rubygems.rb.

    Thus, if you remove the original rubygems.rb and it's rubygems dir (.../lib/ruby/<version>/rubygems*), the warnings will disappear.

  • Jeremy Kemper

    Jeremy Kemper February 8th, 2010 @ 07:43 PM

    • State changed from “new” to “duplicate”

    If Gem is defined, the require would have worked, so this AS patch is unneeded. Thanks for the investigations, though.

  • trevor

    trevor February 8th, 2010 @ 10:36 PM

    as pointed out by Balazs Nagy the "warning: already initialized constant" comes from Ruby cruft. removing the old library directory and starting with a fresh install removes those warnings.

    note, this does not fix the verbose "Invalid .gemspec format in" warnings.

    here's approximately what I did on OS X (snow leopard).

    gem list --no-version > gem_list.txt
    sudo mv /usr/local/lib/ruby /usr/local/lib/ruby-old
    # install
    sudo su
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    gem install rails --pre
    gem install sqlite3-ruby
    env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
    # install remaining gems
  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by