Trouble installing new gems? (Part II)

Posted by David December 19, 2007 @ 04:23 PM

A number of users have reported problems installing the latest Rails gems, especially on Windows. The solution is to upgrade RubyGems to version 0.9.5 1.0.0 before upgrading. You can check your RubyGems version by:

gem --version

If 0.9.5 1.0.0 is not the answer, do (you may not need to prefix with sudo, on OS X you do, some ‘nix distributions too, but not Windows):

sudo gem update --system

Then do:

sudo gem install rails

And while this should no longer be an issue, you can always install Rails from the Rails gem repository if the official one is having issues for whatever reason (such as right after a new release where the mirrors have some times not caught up and are spewing 404 errors):

sudo gem install rails --source http://gems.rubyonrails.org

If you want to use SQLite3 for a new application, first make sure that you have SQLite3 itself installed. If not, you can get it from the SQLite download page. Then make sure you have the Ruby bindings installed (the gem is called sqlite3-ruby). If you don’t, just:

sudo gem install sqlite3-ruby

If you don’t want to use SQLite3, that’s fine. Just do “rails -d mysql myapp” when creating your new application to get MySQL preconfigured. Or “rails -d postgresql myapp”. Or any other adapter you might want to use that you have installed, like Oracle, SQL Server, or what have you. The only thing we changed was which database adapter would be preconfigured if you didn’t explicitly set which to use.

UPDATE: RubyGems 1.0.0 is now out, which should fix the problems with Mongrel and Windows.

Posted in Documentation | 66 comments

Comments

  1. Derek on 19 Dec 17:24:

    It’s interesting you’d suggest to upgrade Windows to RubyGems 0.9.5. There are some serious problems with that version on Windows. I downgraded to 0.9.4 and couldn’t be happier. Sure, I’m upset I have to type “-y”, but at least I can actually install gems.

    I hereby declare 0.9.5 the Vista version of RubyGems.

  2. Phil Thompson on 19 Dec 17:46:

    Yes indeed. One of the problems with 0.9.5 on Windows is that Mongrel doesn’t run. And I couldn’t install Rails from the official repo either as it says the gem is not found (after asking you which version you want. Interestingly the latest version doesn’t indicate which platform it’s for. Shows “Rails 2.0.2 ()”). I had to install the new version of Rubygems then install Rails then reinstall Rubygems 0.9.4

  3. Johan van der Kuijl on 19 Dec 18:26:

    On my XP laptop I downloaded the 0.9.4 zipfile of rubygems and ran ‘ruby setup.rb’. Then I had some 404 problems with ‘gem install rails’ so i decided to use the previous version, which installs with ‘gem install -v=2.0.1 rails’ and this works fine.

  4. Marcel Maigre on 19 Dec 18:48:

    @ernesto: hey that’s nice. I want to earn easy money with rails too.

  5. James Harrison on 19 Dec 18:51:

    It should be noted that 0.9.5 seems to break Mongrel (At least on Windows). However, using the 095 trick to get Rails installed and then downgrading to 094 again to do anything else seems to work quite nicely.

  6. Dr Nic on 19 Dec 19:51:

    DHH – we need to fix up the Rakefile/gemspec to add “s.platform = Gem::Platform::RUBY” to fix this bug.

    It was first discovered – http://www.dcmanges.com/blog/rubygems-0-9-5-platform-bug, and now its a known problem for Hoe too http://rubyforge.org/tracker/index.php?func=detail&aid=16245&group_id=1513&atid=5923

    I’ll go add it to RoR trac as well.

  7. Jesper Rønn-Jensen on 19 Dec 19:51:

    WARNING for Windows users: Don’t install rubygems 0.9.5 before you read and understand that it can actually break your mongrel.

    Alternatively, wait a few days on Rubygems 1.0

    I collected the relevant info here: http://justaddwater.dk/2007/12/09/rails-20-gem-install-windows-mongrel-trouble/

  8. Dr Nic on 19 Dec 19:57:

    Ok, looks like the gemspecs been fixed by r8438 (bitsweat). If you release 2.0.3, you won’t need to force ppl to upgrade rubygems.

  9. Peter Harkins on 19 Dec 21:01:

    Can I have a simple one-line shell command to give me the root password to all the servers I use? Without it the sudo commands don’t work, and not all of us have root on all our servers.

    ...and maybe a one-liner for the folks who have RubyGems installed from a package manager?

    I’m grumpy, but my point is that updating system software isn’t always trivial. Please release a 2.0.3 with the fix from r8438.

  10. Skyblaze on 19 Dec 21:29:

    Ahhh..Are there still people who use windows to develop? :)

  11. Jared on 19 Dec 21:40:

    I very rarely comment on these sorts of postings but I have to chime in with my experiences.

    I’ve had nothing but problems with 0.9.5 on virtually every machine I’ve tried it on. Because of the issues I’m sticking with 0.9.4 for the time being. I am also experiencing the “Rails 2.0.2 ()” problem with gem update, I guess due to me being on 0.9.4. I hope these issues are worked out soon because it seems like its getting progressively worse.

    I suppose I could try the upgrade->install->downgrade option, but I’d really prefer not to.

  12. Neeraj on 19 Dec 21:41:

    0.9.5 would not let RMagick run on windows. I had to downgrade to 0.9.4.

    Yes it’s the vista version of gems.

  13. Luis Lavena on 19 Dec 21:55:

    @Neeraj, @Jared, @Skyblaze:

    We had a lot of reports and issues with 0.9.5. Even Mongrel is broken.

    I tried to summarize the situation here:

    http://blog.mmediasys.com/2007/12/19/latest-rubygems-and-rails-is-a-deadly-combo/

    Also: this global break was a necesity, please read the reason there.

  14. Luis Lavena on 19 Dec 21:55:

    @Neeraj, @Jared, @Skyblaze:

    We had a lot of reports and issues with 0.9.5. Even Mongrel is broken.

    I tried to summarize the situation here:

    http://blog.mmediasys.com/2007/12/19/latest-rubygems-and-rails-is-a-deadly-combo/

    Also: this global break was a necessity, please read the reason there.

  15. Jared on 19 Dec 22:06:

    @Luis

    Thanks for the link!

  16. Dr Nic on 19 Dec 22:11:

    @PeterH – here’s a capistrano recipe that should do the trick:

    http://snippets.dzone.com/posts/show/4905

  17. Joe Ruby on 19 Dec 23:02:

    especially on Windows

    It’s probably not worth worrying about all three of those users. :P

  18. Pedro on 20 Dec 01:56:

    Hi, I just did gem update—system 0.9.5

    Then gem update rails

    Now I have a broken Rails 2.0.2

    c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:377:in `report_activate_error’: RubyGem version error: activesupport(1.4.1 not = 2.0.2) (Gem::LoadError)

    I even uninstalled and installed again.

    Any ideas?

    Thank you.

  19. florian on 20 Dec 08:34:

    after upgrading gem to 0.9.5 mostly all of my test failed because of a yaml error.

    i am on mac osx 10.5.1, rails 1.2.3.

    fastest solution for me: downgrading to gem 0.9.4 as described here http://justaddwater.dk/2007/12/09/rails-20-gem-install-windows-mongrel-trouble/

    if anybody has a better solution for this problem, i am eager to hear it!

  20. Horace Ho on 20 Dec 13:53:

    after

    gem update --system

    and gem -v, my XP shows:

    1.0.0
  21. Mike Hodgson on 20 Dec 14:48:

    gem 1.0.0 is now out. To fix the mongrel issues on Windows, I did the following:

    gem update—system gem install mongrel gem clean

    worked like a charm!

  22. Jared on 20 Dec 14:56:

    Wow, very cool. I wonder if our complaining had a little bit to do with getting that out the door. In either case it’s working on my win box, just gotta test out the mac now.

  23. Ruben on 20 Dec 14:59:

    I have the same Problem.. with Windows..

  24. Hellday on 20 Dec 15:01:

    So it’s hell day… This is the error I get, very little documentation on it.

    I do: gem update—system

    And now I get: /usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

    Whenever I try to run any gem task.

    Any ideas? There was one suggestion on the web suggesting to remove /usr/local/lib/site-ruby

    This works, but brings me back to rails 0.9.0

    No way of getting to rails 0.9.4 or 0.9.5

    I’m on debian.

    Any suggestions?

  25. Jared on 20 Dec 15:02:

    Woops, spoke a little too soon. win32-api is not working for me, saying nmake is not recognized. I know this isn’t a support forum but just wanted to comment.

  26. loµis on 20 Dec 16:42:

    Hi this is great !!! but i get a problemm :(

    i type gem update—system on windows but it tell me this :


    gem update—system

    Updating RubyGems… Attempting remote update of rubygems-update Successfully installed rubygems-update-1.0.0 1 gem installed Updating version of RubyGems to 1.0.0 Installing RubyGems 1.0.0 ‘D:/Program’ is not recognized as an internal or external command, operable program or batch file.

    why? the ruby ordner is in d:

  27. Rodger on 20 Dec 17:41:

    Seems rubygems 1.0.0 hasn’t quite hit all the mirrors yet? Anyways, threw up a kind of quick start for the Mac OS 10.4 (Tiger) users out there to build from source …

    http://rodgerballard.wordpress.com/

    Yeah I know there’s like 500 of these things, this one is how I like to roll for development. :P

    I wonder how the whole 1.9 transition will turn out.

  28. Luis Lavena on 20 Dec 19:30:

    @Jared: I’ve updated my post regarding this issue:

    http://blog.mmediasys.com/2007/12/19/latest-rubygems-and-rails-is-a-deadly-combo

    @florian: 1.0.0 fixes most (if not all) of the mswin32 issues.

    @louis: Try downloading the rubygems-1.0.0.zip file form RubyForge, unpack it and manually install with ruby setup.rb install

    Path with spaces are problematic, no matter if it’s windows or *nix box.

    @Hellday: you broke your debian setup. Let me guess, you tried gem update—system when you installed rubygems from apt-get, right?

  29. Phil Thompson on 21 Dec 01:33:

    Seems like everyone is hard at work. Rubygems 1.0.0 has been released (as mentioned) and it seems mongrel is now working on windows.

    gem uninstall mongrel (select all versions) gem update—system gem install rails gem install mongrel

    There are still some issues with mongrel_service but these are apparently being addressed (it’s to do with Rubygems automatic platform selection).

  30. Phil Thompson on 21 Dec 01:34:

    Formatting!

    gem uninstall mongrel (select all versions)

    gem update—system

    gem install rails

    gem install mongrel

  31. loµis on 21 Dec 01:47:

    I did it this formatting,but mongrel dont start… in Eclipse(Windows).....

    Why?

  32. Quon on 21 Dec 06:14:

    the gem now is 1.0.1 I install a VS2005 on the Windows XP and use the vcvars32.bat environment to compile the gem

  33. Hellday on 21 Dec 10:02:

    @Luis Lavena: Yes, Yes indeed! You were correct!

    Fixed it by removing all ruby related apt-get packages and only reinstalled ruby itself and the libs it needs.

    Then I downloaded and setup gems manually.

    Is that ok, or should remove those too and compile ruby 1.8.6 myself?

    Thank you sir!

  34. louis on 21 Dec 14:04:

    how can i install all manualy on Windows.. when i want update to gem version 1.0.1 it doesnt work.

    D:\Program Files\ruby>gem update—system Updating RubyGems… Bulk updating Gem source index for: http://gems.rubyforge.org Attempting remote update of rubygems-update Successfully installed rubygems-update-1.0.1 1 gem installed Updating version of RubyGems to 1.0.1 Installing RubyGems 1.0.1 ‘D:/Program’ is not recognized as an internal or external command, operable program or batch file.

  35. Redbeard on 21 Dec 18:48:

    @louis regardiing the ‘D:/Program’ problem.

    I just had the same issue. Since spaces are an issue, I changes my path (in the environmental variables) from ‘c:\program files\ruby\bin’ to reflect 8.3 notation, i.e. ‘c:\progra~1\ruby\bin’ and it installed just fine.

    Hope it helps

  36. Rob on 21 Dec 18:58:

    @louis: you can also manually run the setup

    1. Run: gem update—system and get the error message

    2. Go to the gems folder on your system (for me it was C:\Program Files\ruby\lib\ruby\gems\1.8\gems\rubygems-update-1.0.1)

    3. Run: ruby setup.rb

    4. Check everything is OK with a gem -v

    After that I was able to update to Rails 2.0.2 without any problems.

  37. Ajasja on 21 Dec 19:12:

    @Pedro: I had the same problem. It look’s like the rails dependencies aren’t working properly… I had to manually update all other packages: gem update activesupport activerecord actionpack actionmailer activeresource Verify that rails works: rails -v (should print Rails 2.0.2)

  38. Suchmaschinenoptimierung on 22 Dec 17:22:

    I have the same problem. Has anybody a solution for this issue?

  39. Anton on 22 Dec 18:26:

    @Rob … Thanks very much! It was really help!

  40. Antoine on 22 Dec 19:23:

    Unfortunately,

    deprec will not work anymore :

    cap install_rails_stack

    ...

    you know how to solve this issue ?

    Antoine

  41. Dom on 23 Dec 05:40:

    Damned if I’m going to update – I’m sticking with 2.0.1 until this gets sorted. This is getting a bit ridiculous.

  42. http://www.artikelverzeichnis-service.de on 23 Dec 19:15:

    can somebody help me with the formation?

  43. Valentin on 23 Dec 21:44:

    Thank you, it helps a lot.

  44. Nikolay Kolev on 23 Dec 21:49:

    It’s embarrassing that RubyGems went out without basic testing on a major platform – Windows. I have the latest 1.0.1 release and major gems still don’t work! json is one of them, but many other gems depend on it. It’s frustrating – 3 releases (0.9.5, 1.0.0, 1.0.1) and over a month without a fix!

  45. Nikolay Kolev on 24 Dec 04:56:

    It seems that it doesn’t work on Debian either (another major platform) – neither via gem update --system, nor via install from source. Going back to 0.9.4 and will stay on it for a while!

  46. Antoine on 24 Dec 15:24:

    Go to this post to solve the problem!

    http://blog.ra66i.org/archives/informatics/2007/12/23/a-quick-gem-101-faq-gemrunner-name-error/

  47. Christopher on 24 Dec 18:26:

    even with RubyGems 1.0.1 I can’t install win32-service. I get the same error about ‘nmake’ as before.

  48. Timur on 25 Dec 02:38:

    Thanks i solved it!

  49. Luis Lavena on 25 Dec 03:42:

    @Christopher: I commented about that at ruby-talk:

    http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ab875c94f03b85ab/ed8dd525f02b2862#ed8dd525f02b2862

    It seems win32-service and win32-api both are build with 0.9.5, which was broken for mswin32.

    I suggest you contact Daniel Berger (win32utils) and inform about the issue, so he can re-release packages with the corrections.

  50. Rene on 25 Dec 12:04:

    I love ruby but i use it only on *unix

  51. Alan on 26 Dec 00:43:

    In Windows, which of the files do you use for RubyGems please? I’m used to .zip files.

    rubygems-1.0.1.tgz    240 KB    3,692    Any    Source .gz

    or

    rubygems-update-1.0.1.gem    246 KB    944    Any    .gem (RubyGem)

    I’m new but missing something. Which one of these will get you the .rb file?

  52. Alan on 26 Dec 01:22:

    Please disregard last message.

    I’m on Win XP.

    I got the 1.0.1 gem to uninstall and used the ruby setup.rb command while in the setup.rb directory. THe problem is the system hangs after working for a while. It hangs on “Installing rubygems-1.0.1 rdoc in c:/rub/lib/ruby/gems/1.8/doc/rubygems-1.0.1/rdoc…”

    Does any one know why this happened?

  53. Alan on 26 Dec 02:04:

    Another question:

    After ruby setup.rb, I got the following message at the end of the setup. Is everything ok? Thanks.

    Installing rubygems-1.0.1 ri into c:/ruby/lib/ruby/gems/1.8/doc/rubygems-1.0.1/r i… Installing rubygems-1.0.1 rdoc into c:/ruby/lib/ruby/gems/1.8/doc/rubygems-1.0.1 /rdoc… As of RubyGems 0.8.0, library stubs are no longer needed. Searching $LOAD_PATH for stubs to optionally delete (may take a while)... ...done. No library stubs found.

  54. rawgamer on 27 Dec 09:40:

    @ all windows users: Get your hands on linux and have fun and no problems with ruby. :) U can start with a virtual machine using the free VMware server on your Windows.

  55. SSS on 27 Dec 13:22:

    Here is are the steps to get things right 1.Uninstall the current rails – gem uninstall rails 2. Uninstall the current rake – gem uninstall rake (with out this rails installation was throwing error) 3.clean up – gem clean 4.Down load the gems 1.0.1, unzip it 5.cd to the gems unziped folder 6.install new gem – ruby setup.rb 7. verify – gem -v , should report 1.0.1 8.clean up again – gem clean 9.Install rake – gem install rake , this will install rake 0.8.1 10.install rails – gem install rails thats it…it took some combos for me to figure this out

  56. BZ on 29 Dec 21:23:

    Hmm…. I was looking forward to switching to sqlite, but installing the gem fails.

    I upgraded rubygems to 1.0.1, checked whether I already had the sqlite gem, and then tried to install it. It failed, so I doubled-checked that sqlite was installed on my machine (Leopard) and it is.

    Here’s a snippet from the Terminal session:
    DrTeeth:~ brandon$ whereis sqlite3
    /usr/bin/sqlite3
    DrTeeth:~ brandon$ sudo gem install sqlite3-ruby
    Password:
    Building native extensions.  This could take a while...
    ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.
    
    /usr/local/bin/ruby extconf.rb install sqlite3-ruby
    checking for sqlite3.h... yes
    checking for sqlite3_open() in -lsqlite3... no
    
    make
    make: *** No rule to make target `ruby.h', needed by `sqlite3_api_wrap.o'.  Stop.
    
    Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1 for inspection.
    Results logged to /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ext/sqlite3_api/gem_make.out
    DrTeeth:~ brandon$ 
    DrTeeth:~ brandon$ sqlite3 --version
    3.4.0
    DrTeeth:~ brandon$ 
    
  57. ben on 29 Dec 21:54:

    For people trying to use deprec with ubuntu (slicehost people)... try this – I think it fixes the cap1 install_rails_stack issues.

    http://forum.slicehost.com/comments.php?DiscussionID=1140&page=1#Comment_7123

  58. Russell on 03 Jan 03:37:

    Ben’s suggested link worked for me to get deprec 1.9.1 with ubuntu working again.

  59. Anna on 04 Jan 11:11:

    Thanks i solved it!

  60. Anshuman on 04 Jan 16:58:

    I have the gem v 1.01 installed.

    I type in gem install rails, it acts as if it is installing and then I recieve,

    ERROR: While Executing gem …(Gem::RemoteFetcher::FetchError)Bad file descriptor – connect(2) (Errno::EBADF) getting size of http://gems.rubyforge.org/Marshal.4.8

    I am not sure what any of that means. But I have not been able to install rails successfully. The standalone version installed but on a different directory, I am not sure if the dependencies have been installed or not.

    Any help would be greatly appreciated

  61. Johan van der Kuijl on 05 Jan 09:46:

    @Anshuman

    You are probably behind a proxy. You can specify a proxy before installing rails:

    set http_proxy=http://yourproxy:yourport

    Then it should work.

  62. Anshuman on 05 Jan 18:09:

    @Johan

    Thanks for you response. Yes that did seems to be the problem. That information should be added to the installation routine.

  63. Francois on 10 Jan 04:29:

    on FreeBSD 6.2 I just tried:

    gem update—system

    Now when I try to run gem i get the following error:

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

  64. Francois on 10 Jan 04:34:

    Often when using gem I get the following the error:

    ERROR: While executing gem … (Gem::GemNotFoundException) Could not find rails (> 0) in any repository

    Then if I run it again it usually works.

  65. Francois on 10 Jan 04:46:

    using gem 0.94 I was able to install rails 2.02 on freebsd 6.2

  66. german on 10 Jan 12:24:

    Thanks i solved it!