从源代码在windows下安装Ruby是很是苦逼的差事,能够从http://rubyinstaller.org/linux
或者 http://railsinstaller.org/ 下载已经打包好的安装程序。web
RUBY_HOME=rubyinstaller_dir (实际的ruby所在路径)windows
在path中添加 %RUBY_HOME%\binruby
若是使用rubyinstaller安装包需单独下载devkit,下载路径为 DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe 。该文件是7zip压缩包。app
解压缩下载的文件到合适的路径,如F:\Software\develop\DevKit-mingw64-64-4.7.2-20130224-1432-sfxspa
命令行下进入devkit目录,运行 ruby dk.rb init, 运行完后会生成一个 config.yml文件命令行
打开config.yml文件,加入ruby所在路径,如code
# This configuration file contains the absolute path locations of all # installed Rubies to be enhanced to work with the DevKit. This config # file is generated by the 'ruby dk.rb init' step and may be modified # before running the 'ruby dk.rb install' step. To include any installed # Rubies that were not automagically discovered, simply add a line below # the triple hyphens with the absolute path to the Ruby root directory. # # Example: # # --- # - C:/ruby19trunk # - C:/ruby192dev # --- - E:\Ruby21-x64
注意保持上面的格式。orm
5. 命令行下进入devkit目录,运行 ruby dk.rb installcdn
至此ruby运行环境配置好了。在命令行下面能够像在linux下同样安装bundle和其余gem。
在安装rmagick的时候会提示“无效的格式”等等错误,这是由于缺乏ImageMagick的缘由。能够用如下方式解决:
注意两个安装选择项必定要勾上,而且安装路径不要有空格,如program files (微软这个默认路径害死多少人?):
Add application direcotry to your system path
Install development headers and libraries for C and C++