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.

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.
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
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.
@ernesto: hey that’s nice. I want to earn easy money with rails too.
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.
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.
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/
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.
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.
Ahhh..Are there still people who use windows to develop? :)
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.
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.
@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.
@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.
@Luis
Thanks for the link!
@PeterH – here’s a capistrano recipe that should do the trick:
http://snippets.dzone.com/posts/show/4905
It’s probably not worth worrying about all three of those users. :P
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.
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!
after
and gem -v, my XP shows:
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!
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.
I have the same Problem.. with Windows..
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?
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.
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:
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.
@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?
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).
Formatting!
gem uninstall mongrel (select all versions)
gem update—system
gem install rails
gem install mongrel
I did it this formatting,but mongrel dont start… in Eclipse(Windows).....
Why?
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
@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!
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.
@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
@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.
@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)
I have the same problem. Has anybody a solution for this issue?
@Rob … Thanks very much! It was really help!
Unfortunately,
deprec will not work anymore :
cap install_rails_stack
...
you know how to solve this issue ?
Antoine
Damned if I’m going to update – I’m sticking with 2.0.1 until this gets sorted. This is getting a bit ridiculous.
can somebody help me with the formation?
Thank you, it helps a lot.
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!
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!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/
even with RubyGems 1.0.1 I can’t install win32-service. I get the same error about ‘nmake’ as before.
Thanks i solved it!
@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.
I love ruby but i use it only on *unix
In Windows, which of the files do you use for RubyGems please? I’m used to .zip files.
or
I’m new but missing something. Which one of these will get you the .rb file?
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?
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.
@ 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.
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
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$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
Ben’s suggested link worked for me to get deprec 1.9.1 with ubuntu working again.
Thanks i solved it!
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
@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.
@Johan
Thanks for you response. Yes that did seems to be the problem. That information should be added to the installation routine.
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)
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.
using gem 0.94 I was able to install rails 2.02 on freebsd 6.2
Thanks i solved it!