Install ruby 1.9 on Windows using zip binary
Update: This post is outdated. All in one installer for 1.9 is out now, you should use it if you need 1.9 on windows. Get it here http://rubyforge.org/frs/?group_id=167
Ruby has “all-in-one” installer for Windows, but it is outdated. As of May 2009, Ruby 1.9.1 is released, the installer is still 1.8.6. If you want the latest version, you need the zip package. But the zip package is missing zlib.dll, libeay32.dll, ssleay32.dll and readline.dll . Here is how to install it on windows.
Download the file
First you download the 1.9 package from http://www.ruby-lang.org/en/downloads/
Choose “Ruby 1.9 xxx binary” instead of “Ruby xxx Installer”.
Install it
Just Unpack the zip to c:\ruby.
Then add c:\ruby\bin to windows PATH.
Open a windows command console and type
gem update --system
Oops, it is broken! The binary is missing some dll files.
Let us fix it
zlib
Download zlib windows binary from
http://gnuwin32.sourceforge.net/packages/zlib.htm
unzip the package, then find a file named “zlib1.dll”.
Copy “zlib1.dll” to your ruby\bin directory AND rename it to zlib.dll
What the heck?! Why renaming it? Because ruby source code reference the dll as zlib.dll. It is common to use alias like this on Linux. Ruby source was coded on Linux.
openssl
Download openssl windows binary from
http://gnuwin32.sourceforge.net/packages/openssl.htm
Unzip it.
Find “libeay32.dll”, copy to ruby\bin. Don’t rename it.
Find “libssl32.dll”, copy to ruby\bin and rename it to ssleay32.dll
readline
Download readline windows binary from
http://gnuwin32.sourceforge.net/packages/readline.htm
Unzip it.
Find “readline5.dll”, copy to ruby\bin and rename it to readline.dll
Done
That is all. Now type
gem update --system
then
gem install rails
Thanks a lot! Your instructions worked flawlessly.
Bless you for this info!
Forgive me if I’m being dense.
For openssl and readline, should I unzip to c:\ruby as well, or am I just taking the specific dlls?
Thank you.
All of that worked. But I type ‘ruby’ it just hangs… eventually I do a fn-break to get it back to prompt.
nevermind. Got it I think. Next step, trying to make sure everything working. I don’t think this came with sciTe…
- instructions worked well for me, thanks.
Thanks, I hope the rubyinstaller project catches up soon.!
Cheers for this, had everything but the filename change on libssl32.dll figured before reading this, big help in getting it finally sorted. Posted the cliffs notes version of my experience on http://practicaldev.blogspot.com/
You only need the dlls.
Heyyy
I’m kinda nuub…. so in the cmd command line i have open till c:\ruby\bin…. what command do i type before gem update –system and subsequently gem install rails??? else it gives me that gem is not recognized as an internal or external command.. thanks..
You don’t have to type other commands if you are in c:\ruby\bin. If you are not in the directory, you have to add c:\ruby\bin to windows PATH
By the way, this article is for those who wants to try latest ruby features on windows. If you are a newbie, you can download the all-in-one installer package in the ruby homepage, it is somewhat outdated but it works fine.
Hey, can we use both -v 1.8.7 and -v 1.9.1 on windows??
Yes you can, just put them to different directories, and use the full path to call ruby.
Thanks very much! This works perfectly!
I had to find zlib1.dll. The one I downloaded from http://gnuwin32.sourceforge.net/packages/zlib.htm was named zlibwapi.dll (v1.2.3.0) and that did not work. The zlib1.dll that DID work is v1.2.3.2027.
Now I am getting this error a bit further into the gem update:
C:/ruby/lib/ruby/gems/1.9.1/gems/rubygems-update-1.3.5/lib/rubygems/config_file.rb:39:in `new’: wrong number of arguments (5 for 4) (ArgumentError)
Ugh!
@Leslie
Finally I got it working. Had to edit the config file in error, and remove the last parameter
if RUBY_VERSION > ‘1.9′ then
SHGetFolderPath = Win32API.new ’shell32′, ‘SHGetFolderPath’, ‘PLPLP’,
‘L’, :stdcall
Now it is working:
C:\ruby\bin>gem –version
1.3.5
C:\ruby\bin>ruby –version
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
Running this now and it is installing rails:
gem install rails –include-dependencies
Thank you for laying this out in easy to understand terms chap. Outstanding work !!
Thanks very much laying this out so easily and straightforward.
Works perfectly for me.
Your instructions are great. I can run IRB fine and get the gem version and ruby version. However any time I try do any thing else (e.g. gem list), I get a “…no such file to load — zlib (LoadError). Any ideas on what I did wrong?
Works perfect on Windows 7 Enterprise (Final release), thanks for the post!
I have had great success with the rvm gem on cygwin if you are using cygwin.
gem install -r rvm #This will use the installed version of ruby (think its 1.8.7)
rvm-install
rvm install 1.9.1
Now you can use rvm to manage your versions. jruby installed really easy as well (it always installs easily though).
For both zlib and readline there are pure Ruby versions available if you’re tired of dealing with the DLL headaches.
http://github.com/luislavena/rb-readline/
http://rubyforge.org/projects/pure
Though, as I’m typing this, I realize that I’m not sure if they’ve been tested against 1.9.x.
Regards,
Dan
@bluehavana
I thought about cygwin (I liked it a while back for gcc compiling, and *nix commands). I’m worried about the virtual OS/emulation slowdown, compiled with ruby’s already built in malaise. Too slow!
Thanks for the tip though, my backup plan is dual boot if I keep having these development issues with web programming tools.
Ok, that works. But I am unable to rubyw.exe How do I fix that?
Hi,
Thanks for such a great resource on installing Ruby on windows.
These instructions works perfectly.
Regards
Rahul Chauhan
Hi,
Just wanted to thank you so much for this reference. Saved me many hours of frustration.
Edwin
You are welcome, guys
Thank you for this comprehensive procedure! It worked just fine.
Hello
Thanks a lot for that. Works perfectly for me.
awesomeness! it worked! thanks!
Superb, worked as a charm, forgot to add some random DLLs while switching to x64 Win7 a few days ago. Kudos for a great time saver !
Fantastic. Thank you so much for these clear instructions. This was non-trivial with the renaming that has to take place on Windows, and it just seems wrong when you don’t know to do it.
Thank you so much for this guide.
You are a real saver! Thanks a bunch for saving me from this error.
That’s fantastic Mr.Fox. Managed to get it installed on my windows mobile.
FANTASTIC! been stuck on this all morning! thank you so much! Works perfecto!