Install ruby 1.9 on Windows using zip binary

来源:互联网 发布:淘宝恶劣卖家 编辑:程序博客网 时间:2024/06/06 18:55

Update:  This post is outdated. All in one installer for 1.9 is ready 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