Sunday, September 29, 2013

Rails and Windows

In a word ... "Don't".

I often see posts, especially on LinkedIn, with titles like "How do I learn Rails" etc. My advice is always to start with Michael Hartl's Rails Tutorial. A related question that often comes up though is about using Windows to do this. There are often comments that you can use Windows for this, cross-platform is good, etc. The truth though is that you're not going to have a lot of success developing Rails on Windows and if you're looking to move into Rails development as a profession, it will not probably help. There are a few different reasons for this, but first let's take a look a why you should develop for Windows.

If you've decided that Windows is a great platform and that you're ready to do your part to bring it to the Rails community, then by all means, go for it. Very few in the Rails community do use Windows, but if someone was willing to do the work to make everything that's commonly used work together under Windows, then I think it would be welcomed with open arms.

If you're just trying to learn some Rails though, this is probably not a good approach. While you're developing, you're going to have issues come up and those that can help you are going to be few and far between. In fact, even if it's not a problem with Windows per se, the fact that it works on Mac/Linux (or even appears to work there), is going to make it hard to get others interested in the problem. You're almost certainly going to have to come up with a failing test case (you should anyway) and show that this is the case. The problems you are, in general, going to be different than you'd see on a either a Mac or Linux and so most Rails developers won't have seen them and won't be able to help you solve them. Also, a big part of Rails development is done with the command line and while you can get bash or some other Unixy shell running, it's going to be sub-optimal.

For someone who is looking to move into Rails development, this is probably even more true. You're going to have all the issues listed above and those problems and their solutions won't be relevant to the issues your co-workers are going to be having. Additionally, whatever tools (here I'm thinking of editors and editor plugins especially) get adopted internally are unlikely to work well or even at all on Windows. A big part of the Rails development experience is collaboration and you won't really be able to benefit from or contribute to this collaborative process.

So, I recommend either breaking down and buying a Mac (a pretty expensive idea if you're just looking to experiment) or dual booting using Ubuntu (a pretty common platform where you'll be able to get some help easily if you run into issues).

Good luck and I'd be glad to hear your thoughts in the comments and in this case I wouldn't mind all that much being proven wrong.


  1. No need to dual-boot. Just use a VM.

  2. Dave, thanks for you comment. Yes, a VM would absolutely work also.

  3. Your *coding* environment could be windows and your *build* environment could be linux by using a tool like Vagrant (the 'unixy shell' would actually be an SSH into a headless Linux VM). Operating System preference has become less and less of an issue with modern tools.

    1. +1. A number of shops script their vagrant builds using chef, so not only do all devs share the same VM (and hence execution env), but also staging and beyond. Most Ruby devs use either vim, emacs, or sublime for editing, all of which work well on Windows. Plugins... not always so. And git support on Windows is shameful. Last time I had to use a chef/vagrant VM, I hosted it under Ubuntu. Using OSX now, but thankfully on a company laptop. I mean, what if I want a larger hard drive or more memory at some point? ;)

    2. You can have issues with some tools using this setup though. Tools like guard and zeus have a hard time monitoring files not modified on the same OS. I've switched back to a local setup from Vagrant at my current job. It's also much faster.

  4. Marcel, yes, that is true. I think my points above still hold in that you're really developing under Linux. A Vagrant solution would have you (at least in the places I've seen it used), editing locally and then testing and running under Vagrant. At that point, I'm not sure what you've really gained, but if that works for you or others, then great. In the end though, if you want to develop in the Rails world, you're almost certainly going to need to be comfortable using a Linux style command line and working in a Linux environment.

    Thanks for your thoughts.