Update: There is a new effort to create a decent Windows Ruby installer. You can get the new downloadable installers from http://rubyinstaller.org/ though as of August 2009 these are still in preview form. It seems from my brief experiment that you'll still have to set your PATH manually, as per my manual instructions below. This installer also promises a faster Ruby as it builds using superior tools, so might well be worthwhile if only for that. Below are my original manual instructions for installing Ruby on Windows, which should still be just as valid as they always were. The installer is probably worth a look though.

The following worked for me on Windows XP, but maybe I'm yet to run into problems I don't know I've got:

That got ruby working in a basic sense for me, but I wasn't able to install gems. If I tried, I got two errors in sequence: "The ordinal 277 could not be located in the dynamic link library SSLEAY32.dll" and "This application has failed to start because zlib.dll was not found."

The ssleay32.dll problem was solved by getting hold of a couple of DLLs and putting them in the right place, as follows:

  • Download "Win32 OpenSSL v0.9.8k Light" from http://www.slproweb.com/products/Win32OpenSSL.html.
  • Run the installer, but take note of the following:
  • You can ignore any initial warning about not having Microsoft Visual C++ 2008 Redistributables.
  • You can ignore any warnings about command prompts being open.
  • Install to somewhere like C:\OpenSSL – it doesn't really matter, we just need a couple of DLLs.
  • When prompted, choose to Copy OpenSSL DLLS to The OpenSSL binaries (/bin) directory.
  • Once the installer has completed, you can go to C:\OpenSSL\bin (or wherever you installed it) and copy the two files ssleay32.dll and libeay32.dll to your Ruby bin directory, C:\ruby191\bin in my case.

The zlib.dll problem was solved by in much the same way:

  • Download the compiled zlib 1.2.3 DLL from http://www.zlib.net/ (about two thirds of the way down the page).
  • Unzip it to get the zlib1.dll file.
  • Put that file in your Ruby bin directory, but rename it to zlib.dll

Et voila – gems can now be installed successfully! Note that you may have had copies of some of these DLLs in your \WINDOWS\system32 directory already (I certainly did) but the problem is that they are too old. I prefer to put the newer ones directly in the Ruby bin directory, so only Ruby picks them up and it can't break anything else on the system.

20 Comments

  1. Blake Murray

    This was a helpful post to me. I also wanted to comment that all three of the missing files (and the readline.dll which gave me errors running irb) are in the Instant Rail distribution and can be copied from there.

  2. I’m glad it helped. I do rather suspect that there must be an easier way to get the OpenSSL bits.

  3. Why you guys don’t give a ride to 1.9 MinGW-based version instead?
    http://blog.mmediasys.com/2009/05/05/rubyinstaller-state-of-one-click/
    http://blog.mmediasys.com/2009/05/17/rubyinstaller-updated-packages-and-other-news/
    After all, GCC based is where One-Click Installer is heading.
    Cheers

  4. Luca G. Soave

    Very useful article here, actually the only way I found it works. I just missed one more lib on my XP Professional installation: libmx.dll Here it is:
    http://www.dlldll.com/libmx.dll_download.html
    ( to put in C:\ruby191\bin as previous ).
    Many thanks
    Luca G. Soave

  5. Luca G. Soave

    @Luis … I think to get help on that,
    the RubyInstaller project have to go onto http://github.com/
    Reguards
    Luca G. Soave

  6. how do u add c:/ruby191/bin to ur path what do u mean by this statement

  7. You need to set the Windows environment variable PATH to include the directory where the Ruby binaries are installed. This PATH lists the directories that Windows should search when trying to find an executable, so that (for instance) when you type “ruby someapp.rb” on the command line, it knows where the ‘ruby’ executable is. I suggest that you Google for “setting windows PATH environment” or similar.

  8. I had to make a copy of zlib1.dll and rename it zlib.dll.

  9. This post was extremely useful

  10. Thanks very much. Googled the error, found this, solution worked perfectly.

  11. Hi this is a great article. Only thing — I had to change zlib1.dll to zlib.dll. When I typed “gem list” it told me it could not find zlib.dll. So I changed file name and it worked.

  12. hey, thanks for the openssl tips 😀

  13. Perfect. This page should ship with the 1-click installer. Sorts out my probs instantly. Thank you kind sir.

  14. good tutor

  15. The one click installer is being done away with. The method is much cleaner. If the DLLs were already in place it would be a snap but Ruby installed and working is a pain but so worth it!!!

  16. I noticed that the link at the very top was wrong (had gone out of date) so I’ve now corrected it.

  17. If you install Ruby 1.9.1 on Windows 7 64 bit, then you should get the .dlls from the OpenSSL 64-bin version also.
    http://www.slproweb.com/download/Win32OpenSSL_Light-0_9_8n.exe

  18. Also make sure that you download version 0.98 of “Win32 OpenSSL v0.9.8k Light” and NOT version 1.0. I tried version 1.0 and when enterting “require ‘resolv'” I got an error about “Ordinal 132 could not be found in Dynamic Link Library SSLEAY32.dll” or something like that. Then I installed the 0.98 version and copied the DLLs over to Ruby’s bin directory and it worked fine.

Leave a Reply

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