Limitations in Running Ruby/Rails on Windows

Limitations in running Ruby/Rails on windows

Here's an overview of the current issues with Rails on Windows:

  • Ruby and Rails are slower on Windows than they are on Unix-like OS's.
  • A few gems and libraries don't work on Windows.
  • Some Unix-isms aren't available on Windows (examples).
  • The community is mostly on either Mac or Linux (This is a particularly hard one to deal with; nobody wants to be alone on one island when the rest of the tribe are partying, having fun and getting along great over on the other island. Community is important. It seems that most Windows developers that start with Rails quickly switch to a Mac or Linux. However, the small community of Windows Ruby users that do persist are extremely friendly, dedicated and knowledgeable - go say hi.)

Note much of the advice that follows is now outdated due to the magnificent efforts of the RubyInstaller team in bringing stability, compatibility and performance to Ruby on Windows. I no longer have to use VirtualBox, which says a lot about how far Ruby on Windows has come.

If you want more technical detail, the following are required reading. :

  • Ruby for Windows - Part 1
  • Is Windows a supported platform for Ruby? I guess not
  • Testing the new One-Click Ruby Installer for Windows
  • Still playing with Ruby on Windows
  • Chatting with Luis Lavena (Ruby on Windows)

Choice quote from that last one is:

AkitaOnRails: The most obvious thing is that any Gem with C Extensions without proper binaries for Windows will fail. Trying to execute shell commands will fail and RubyInline as well. What else?

Luis Lavena: Hehe, that's just the tip of the iceberg

Having said all that, I don't find developing with Rails on Windows too painful. Using Ruby is, for the most part, a pleasure. I'd avoid InstantRails because, to be frank, it's just as easy to install Ruby properly using the one-click installer, then doing a gem install rails. If you need Apache and MySQL, WAMP is a good bet, although even these aren't required if you just stick with Mongrel and SQLite.

What I've taken to doing recently is running VirtualBox with an instance of Ubuntu Server that closely mirrors the deployment server. I map a network drive to the Ubuntu Server, then I edit and run my code directly on the VM. It uses hardly any memory (it's currently using ~43MB; contrast that with Firefox, which is using ~230MB) and Rails actually performs better than running it natively on Windows. Plus you can experiment with your virtual server in relative safety. It's a really nice setup, I highly recommend it.

Finally, here are a couple of Ruby/Rails blogs aimed at Windows users:

  • DEV_MEM.dump_to(:blog) (Luis Lavena)
  • Softies on Rails
  • Ruby On Windows

Apache module for Ruby on Rails on Windows

Well if you really want to go that route, you could probably use mod_rails or mod_fcgi. It might be an easier route to use a rails-specific webserver like Thin or Mongrel and just attach Apache as a frontend like it's usually done for load balancing.

See here for more inspiration:

Rails on Apache on Windows - HOWTO

However, Ruby on Rails is a pain on Windows even with the nice RubyInstaller packages. I've tried to work in this environment but you will quickly run into problems with gems not compiling or generally incompatible with Windows. Still, there's folks who stick to it.

Again, related posts on SO, which already covered this topic:

Limitations in running Ruby/Rails on windows

Is there anyway to run Ruby on Rails applications on a Windows box?

Ruby 2 and Rails 3 running on windows server

For ruby on rails its better to run it on linux than windows , on windows you will face a lot of problems like when you going to install gems , best thing is to install a vmware on your windows machine , then run Ubuntu or any linux distro you like through vmware, also you can check this question to know more

Is there anyway to run Ruby on Rails applications on a Windows box?

Windows is not the usual place to deploy production Rails apps, but there are people who do it. Mongrel was originally written to give better deployment options for Windows. As it turned out the UNIX deployment options weren't that good either. :)

Start with the Ruby One Click installer so you have a sane installation of ruby and rubygems.

From there, you install the rails gem and the gem for your database like you normally would. Most if not all of the databases have Windows gems.

Make sure to install mongrel_service to be able to control each mongrel like a normal windows service. See mongrel_rails service::install -h for details.

Once you have your mongrels set up, it's similar to a UNIX deployment. You set up a reverse proxy, such as Apache2 and you're set.

You might run into some gems (such as BackgroundRB) that will not work under Windows because they have C code that either rely on UNIX libraries or expect a UNIX-like build system at installation time. However, all of the really important Rails gems, such as Mongrel and the database adapters, have gems with pre-built binaries available, so you'll be fine.

Ruby/Rails running slow on Windows 7

I am using Ruby 1.9.3p392, Rails 3.2.13. The project connects to a mysql database.

  • tried it on Window 7 - server takes 10s to startup, rendering a login page takes over 1 minute.
  • tried it on ubuntu 12.10 virtual machine on virtualbox - twice as worst
  • tried it on ubuntu 12.10 virtual machine on VMWare player - much better, almost on par with Windows 7.

So I bite the bullet and setup a dual boot linux-mint system, and the problems go away. So the problem lies with some low level system api that even a virtual machine is dependent on.

There are other problems with using Windows as well, for example many gems are not compiled for windows (like therubyracer and imagemagic), so you need to jump through the loop to get them to work.

So in conclusion, forget about Windows for RoR development. But seriously, if RoR is made more Windows friendly, I am certain it will be quite a lot more popular. I almost gave up in the process, and it remain a real pain for me having to switch between Windows and Linux every so often.

Ruby on Rails development on windows

I've been developing a Rails website on Windows & Mac (depending on where I am at the time) for a few months now and, in general, I haven't run into to many problems. Here's what I know:

The new Ruby 1.9.3 installer for Windows is nice because it comes with RubyGems (which a vague memory tells me was difficult before). That's what I'm using. I haven't been able to get the ruby-debug19 gem to install correctly on windows. So, I just comment that out in my Gemfile on my Windows computer. Other than that, I haven't had any issues.

With that said, however, I love developing on my Mac so much more than I do on Windows. I haven't found an editor that I love for Rails development on Windows (currently using Sublime 2 or Notepad++ with Explorer plugin), using Git is not as nice on Windows, and I just really don't like the Windows Command Prompt (I know there are other options, but still).

Problems in starting a new ruby on rails project in windows command prompt

It might be your connection as they said here, but it also can be something different. Sometimes, I got an error when I create a new rails projects exactly at the "run bundle install" moment. If the problem persists, you can try the way I did.

You can go to your project folder by typing:

cd first_cms

And then you can install bundle manually:

gem install bundle

Then, you can run the bundle and the project creation will be finished:

bundle install

It worked for me! Hope it works for you



Related Topics



Leave a reply



Submit