Tags

, ,

1. Download Ruby for windows at Ruby Installer
2. After Ruby was installed successfully in your hard drive, you will install DevKit. The DevKit is a toolkit that makes it easy to build and use native C/C++ extensions such as RDiscount and RedCloth for Ruby on Windows. More details about DevKit at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
When executing bundle install or rails new {projectname} you might got an error that says e.g. Gem::InstallError: The ‘json’ native gem requires installed build tools.In that case, you need to install DevKit.

C:\>cd devkit
C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.2 at C:/Ruby192
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby192'
[INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'
[INFO] Skipping existing gem override for 'C:/Ruby193'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby193'

Confirm your Ruby environment is correctly using the DevKit by running gem install rdiscount –platform=ruby. RDiscount should install correctly and you should see with native extensions in the screen messages. Next run

c:\Ruby(versionNumber)>ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html" to confirm that the rdiscount gem is working.

3. After DevKit was installed, go to your Ruby folder e.g. c:\Ruby193>. In your command prompt type this:

c:\Ruby(versionNumber)\bin>gem install rdoc
c:\Ruby(versionNumber)\bin>gem install rails

As you noticed, we install first the rdoc instead of the rails. The reason is that you might encountered an error that says “File not found: lib”.
Although some of the gems are successfully installed.

Some other ways in installing Ruby on Rails on Windows:
You can use Rails Installer. RailsInstaller has everything you need to hit the ground running. In one easy-to-use installer, you get all the common packages needed for a full Rails stack. It includes Ruby, Rails, Git, SQLite, etc.

If you want to install multiple ruby versions in your environment, you can use rvm for linux and pikfor windows.
Click here on how to install pik on windows.

Thats it. Happy RoR!!

About these ads