Sunday, 28 February 2010

Getting Thin to work on windows

Right at the beginning here, developing my new site, I've struggled to the point of RAGE to try and get this Thin server rubbing my Ruby app (under Windows XP)

I reckon here are all the necessary steps (these don't all seem to have been published together)

(If you are behind a firewall see here: http://exceptionz.wordpress.com/2008/03/18/run-gem-install-behind-a-firewall-in-windows/ first )

  1. I Installed MinGW to C:\MinGW (see here for installation instructions). Make sure you install g++.
  2. I then installed MSYS to C:\msys\1.0
  3. I then added c:\MinGW\bin and C:\msys\1.0\bin to my %PATH% (PATH %PATH%;C:\MinGW\bin;C:\msys\1.0\bin) (This assumes you have the Ruby\bin directory in your path already). This is done best via the Environment variable section (right click My Computer, Properties, Advanced, Environment Variables)
  4. Run
    gem install thin --platform=ruby
    The last bit seems important to force it to work under Ruby 1.9.1
  5. Finally go to your app directory and type
    thin start
(NOTE: edited to take account of new version of Thin)

Good luck! I was filled with rage and irritation for many, many hours trying to get this to work.