Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Problem with Rails installation (RailsInstaller - Windows)

I haven't been able to get RUBY and Rails installed RIGHT. ( in order to proceed to the Ruby on Rails course.) I mean, I followed the directions dictated by the course: installed rails (all the scaffolds, etc.) AND ruby. However, as I got into the development and everything, the Rails server kept erroring

2 Answers

Ohh. I've tried using Rails on Windows last year for a major project. It was a complete nightmare as some gems wouldn't work, etc and I eventually used Ubuntu via virtual machine.. I would highly recommend using a Mac or Linux variant for Rails development (even if through VM) if nothing has changed since I last tried it.

Thanks for the reply. Just as you mention it, I have also attempted to install Virtual Box (ORACLE) for a PHP endeavor. However, I CANNOT, for the life of me, get phpmyadmin, OR localhost to connect , the guest extensions, etc., once I got it completely installed. Any suggestions on a stable, reliable VM that run on Windows 7???

I used VMWare Player. Anything else, I can't remember. I will say that I did get RailsInstaller to work on Windows outside of a vm but the gems I was required to use on the project didn't have Windows binaries and I didn't know about DevKit at the time so my situation is different.. Kevin made some good points so if you want to proceed with Windows and no vm, by all means give it a try. :)

I forgot to mention: Use the 32-bit edition of Ruby 2.0, not the 64bit edition, and you should be fine; unfortunately a bug occurs with the 64-bit edition of Ruby 2.0 involving a gem Rails (both 3 & 4) depends on falsely recognizes the CPU (or OS) having an improper/valid architecture with the 64-bit version of Ruby 2.0. It's still unsolved, and probably won't for some time.

In most cases, merely use --platform=ruby as a added parameter to your gem install and DevKit will do the rest; i.e. gem install bson --platform=ruby.

Another rare case is some gems (almost exclusively the database gems) where you have to get the original binaries files (.h) files from the curators or official source (i.e. sqlite). Earlier this year

Finally, another gotcha is that the gem successfully compiled by devkit, but you have to go to the folder of your Ruby installation to properly copy the file to the place it's supposed to go with two folders for the gem being created (one where the gem is expected to be for Rails or another program, and another folder where the gem compiled).

Gems I've come across that I've had to do this for was the pg (PostgreSQL) gem.

It honestly is not that confusing if you're familiar with making Ruby gems and compiling code in general, but such cases are fortunately discoverable on Github, StackOverflow, and so on.

First and Foremost

I've used Windows 8 (and 7) with Rails 4 and Ruby 2.0 for over 5 months (I've used several Rails 4 beta and RC versions ) with no issues. I use both Windows & Mac for web design and web development. I never had issues using either when it comes to being productive w/ Rails.

Only fundamental adjustment you have to understand with using Windows is the quirks that come with it being a non-POSIX Operating System.

Accordingly, because of that characteristic of Windows alone, I would certainly avoid developing on Windows if you can avoid it.

The solution to this problem

You merely have to understand how some Gems pre-compile (or not) and why that can be an issue for a variety of platforms and the fundamental changes of how that works that Ruby 2.0 made somewhat of a hassle at first. Rails Installer is not how I would prep your Windows machine for Rails at the moment unless this week they released a new version. I've used Windows w/ Ruby and Rails for almost two years with no problem using Windows. Including things such as Yeoman and grunt.

Anyhow, install Ruby first by going to RubyInstaller.org (or .com; may be wrong)

Then install the Devkit on the same site. From there, unzip the DevKit to your C: drive and use your console program of choice to go to it and follow the instructions that the Github DevKit site provides (or RubyInstaller's instructions before downloading it).

From there, you can use gem install rails --versions 4.0.0 or merely gem install rails

Regarding Some Gems not working on Windows

When it comes to some gems on Windows, particularly since Ruby 2.0, some gems are precompiled in a way you must use DevKit to circumvent. Some gems however heavily rely on things only a POSIX-conforming OS or features that are OS-specific, and thus won't work on Windows.

A gem like that is Zeus. Those are few and far between. Particularly with Rails development that's sort of a oh well considering a lot of gems focus on web-specific problems that we all know of course is not dependent on the operating system but the browser, database system, and etc your Rails app is on, not OS-specific.

Note: Typing this on my iPhone wasn't the best way to reply, but hope all that helps.