How to compile ruby from source on Windows?

I wanted to play with the latest version of ruby. I got the win32 binary zip of 1.9.1 p0 - however irb used to popup an error message on startup - used it for sometime but then I decided to fix it. Checked back on ruby's download page and found an updated version p129. Downloaded it but it was a source zip.

I wasn't sure that compiling it from source would be trivial... however it reinforced the simplicity of the ruby way. Summarizing the steps I found on this post at ruby-forum.com

  1. Get the source zip from the download page and unzip it locally to say c:\ruby-src
  2. Open the Visual Studio Command prompt (I have VS2008 on WinXP SP2)
  3. Make a folder for your build say c:\ruby-build. Move into it / change dir
  4. c:\ruby-build> c:\ruby-src\ruby-1.9.1-p129\win32\configure.bat
  5. c:\ruby-build> nmake
  6. c:\ruby-build> nmake test
  7. c:\ruby-build> nmake DESTDIR=c:/ruby-build install
That's it.. you'll find the binaries within a usr folder within the ruby-build folder.

4 comments:

  1. Ruby 1.9 is also now available as one-click installers for Windows - you can get them at http://rubyinstaller.org/ . Look for "Technology Previews"
    (as someone had commented earlier..I changed my commenting system from Haloscan back to blogger and lost all the comments. )

    ReplyDelete
  2. Hi
    Im getting this error

    D:\Ruby on Rail\Ruby Build>D:\Ruby on Rail\ruby-1.9.3-p286\win32\configure.bat
    'D:\Ruby' is not recognized as an internal or external command,
    operable program or batch file

    Thanks in Advance

    ReplyDelete
    Replies
    1. Use quotes around "d:\ruby...configure.bat" or Rename your folder to Ruby_On_Rail.
      The shell is interpreting d:\ruby as a command due to the spaces in 'Ruby On Rail'

      Delete