Eric Guo's

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

Install Ruby 1.9.3 P125 & Rails 3.2.6 on Windows 7


Some blogs says Windows is not a right platform to start Learning Ruby, maybe it’s right, but anyway, I just successfully install the latest Ruby&Rails web stack following below steps:

  1. Install RailsInstaller as a whole exe (56.6MB), if you want to access that file in China, please use this link instead, you may have to register 115 account first.
  2. After install, For C:\RailsInstaller\scripts\config_check.rb, you need to change:
    :home        => File.join( ENV[“HOMEDRIVE”], ENV[“HOMEPATH”] ), :ssh_path    => File.join( ENV[“HOMEDRIVE”], ENV[“HOMEPATH”], “.ssh” ), :ssh_key     => File.join( ENV[“HOMEDRIVE”], ENV[“HOMEPATH”], “.ssh”, “id_rsa”), :ssh_pub_key => File.join( ENV[“HOMEDRIVE”], ENV[“HOMEPATH”], “.ssh”, “”),
    :home        => ENV[“HOME”], :ssh_path    => File.join( ENV[“HOME”], “.ssh” ), :ssh_key     => File.join( ENV[“HOME”], “.ssh”, “id_rsa”), :ssh_pub_key => File.join( ENV[“HOME”], “.ssh”, “”),
    And create %HOME% environment in System Properties->Advanced->Environment Variables and REM the SET HOME=%HOMEDRIVE%%HOMEPATH% in c:\RailsInstaller\Ruby1.9.3\setup_environment.bat, then you should be able to run “Command Prompt with Ruby and Rails”
  3. gem source -r # if you have VPN, you can skip step 2 & 3
  4. gem source -a
  5. gem update ––system
  6. gem update
  7. gem install win32console #enable colorize_logging in windows
  8. gem install vmc #if plan to deploy your rails application in Cloud Foundry
  9. gem install ruby-oci8 #if plan to deploy your rails application in Oracle DB)
  10. gem install activerecord-oracle_enhanced-adapter #if plan to deploy your rails application in Oracle DB
  11. gem install pry #an IRB alternative and runtime developer console
  12. gem install pry-doc
  13. gem install mongoid
  14. gem install bson_ext
  15. gem install linecache19 #below three line is need if you want to debug with RubyMine
  16. gem install ruby-debug-ide
  17. gem install ruby-debug-base19-0.11.26.gem – –with-ruby-include=“C:\RailsInstaller\Ruby1.9.3\include\ruby-1.9.1\ruby-1.9.3-p125”
  18. gem install specific_install
  19. gem specific_install -l # build eventmachine or use below to install a precompile version
  20. gem install eventmachine –pre # version eventmachine-1.0.0.rc.4-x86-mingw32.gem works in Windows 7
  21. gem install thin # new version 1.4.1 need add gem ‘thin’ in Gemfile to work successfully
  22. gem clean (clean some outdated gems during above installation, say n if any depend warning)

After install and if you already install Git in “C:\Program Files\Git” like me, you can delete the Git folder “C:\RailsInstaller\Git” installed by RailsInstaller and make a Junction link to your existing one (need in the administrator cmd prompt) to save 250+ MB hard drive.

C:\windows\system32>mklink /J C:\RailsInstaller\Git “C:\Program Files\Git” Junction created for C:\RailsInstaller\Git <<===>> C:\Program Files\Git
You can also edit the file “C:\RailsInstaller\Ruby1.9.3\lib\ruby\1.9.1\webrick\httpresponse.rb”, line 205 and add red part to avoid very annoying warning.

if chunked? || @header['content-length'] <span style="color: #ff0000;">|| @status == 304 || @status == 204</span>