http://www.cnblogs.com/1034009199ruby/p/3536531.html
伙伴们偷偷私聊畅言这Ruby On Rails开发环境总哪么的莫名其妙的就配置失败。左思萌想都觉得不可理喻。许多人都说FQ什么来的,说得天花地乱,人心惶惶的。安装失败时那愤怒之言都是IT的肺俯之言,句句都是泪的悲哀与悲伤。我向来很少编程序开发的,只能说几句:爱莫能助的闲言碎语以及些许的安慰之言。亦未知是否在他们的伤痕里偷偷洒了一把盐酸一样的盐粒。今天感情就为你们牺牲一回,狠狠狠地搭建Ruby On Rails的环境,以报答我们纯纯的友谊。
第一步下载安装:rubyinstaller-2.0.0-p353
官方网站:http://rubyinstaller.org/downloads/
安装细节过程需注意的为添加环境变量选项打构,省事,偷懒这种事情我最爱。我的安装路径狠心地让它安置在我心目前中的极其重要的位置业:C:\Ruby200
检查我们的宝贝安装是否完美无瑕。
自我感觉神州行,还行!
第二步下载安装:DevKit-mingw64-32-4.7.2-20130224-1151-sfx
官方网站:http://rubyinstaller.org/downloads/
注意安装路径不能有空格,我的路径为:C:\devkit
然后通过CMD命令行进入:C:\devkit\bin 执行:
- ruby dk.rb init
这帮忙你找到系统已安装的ruby的安装路径,如果系统没找到,你亦可以手动设置一下,将:C:\devkit下的config文件添加路径即可。
1 # This configuration file contains the absolute path locations of all 2 # installed Rubies to be enhanced to work with the DevKit. This config 3 # file is generated by the 'ruby dk.rb init' step and may be modified 4 # before running the 'ruby dk.rb install' step. To include any installed 5 # Rubies that were not automagically discovered, simply add a line below 6 # the triple hyphens with the absolute path to the Ruby root directory. 7 # 8 # Example: 9 # 10 # --- 11 # - C:/ruby19trunk 12 # - C:/ruby192dev 13 # 14 --- 15 - C:/Ruby200
- ruby dk.rb install
即可安装完毕。
第三步:安装Rails
许多伙伴们喜欢选择通过http://railsinstaller.org/en 下载:railsinstaller-2.2.2进行安装。其实如果安装过程中会发现,该可执行安装包已然包含版本:Ruby 1.9.3.囊括上述的DevKit等插件。一句话这railsinstaller-2.2.2是应有尽有。
我很不喜欢推荐这种方式,版本古老,我就是不喜欢。
首先进入Ruby的安装目录:C:\Ruby200\bin 然后执行C:\Ruby200\bin>gem install rails 这可是爱情之路缓慢的漫长等待,二十分钟的地久天长,我的网速仅比蜗牛略胜一筹罢了,只因下载:Installing ri documentation for rails-4.0.2 文档,听闻这可是讨厌的庞然大物。
1 C:\Ruby200\bin>gem install rails 2 Temporarily enhancing PATH to include DevKit... 3 Building native extensions. This could take a while... 4 Successfully installed atomic-1.1.14 5 Fetching: thread_safe-0.1.3.gem (100%) 6 Successfully installed thread_safe-0.1.3 7 Fetching: activesupport-4.0.2.gem (100%) 8 Successfully installed activesupport-4.0.2 9 Fetching: builder-3.1.4.gem (100%) 10 Successfully installed builder-3.1.4 11 Fetching: rack-1.5.2.gem (100%) 12 Successfully installed rack-1.5.2 13 Fetching: rack-test-0.6.2.gem (100%) 14 Successfully installed rack-test-0.6.2 15 Fetching: erubis-2.7.0.gem (100%) 16 Successfully installed erubis-2.7.0 17 Fetching: actionpack-4.0.2.gem (100%) 18 Successfully installed actionpack-4.0.2 19 Fetching: activemodel-4.0.2.gem (100%) 20 Successfully installed activemodel-4.0.2 21 Fetching: arel-4.0.1.gem (100%) 22 Successfully installed arel-4.0.1 23 Fetching: activerecord-deprecated_finders-1.0.3.gem (100%) 24 Successfully installed activerecord-deprecated_finders-1.0.3 25 Fetching: activerecord-4.0.2.gem (100%) 26 Successfully installed activerecord-4.0.2 27 Fetching: mime-types-1.25.1.gem (100%) 28 Successfully installed mime-types-1.25.1 29 Fetching: polyglot-0.3.3.gem (100%) 30 Successfully installed polyglot-0.3.3 31 Fetching: treetop-1.4.15.gem (100%) 32 Successfully installed treetop-1.4.15 33 Fetching: mail-2.5.4.gem (100%) 34 Successfully installed mail-2.5.4 35 Fetching: actionmailer-4.0.2.gem (100%) 36 Successfully installed actionmailer-4.0.2 37 Fetching: thor-0.18.1.gem (100%) 38 Successfully installed thor-0.18.1 39 Fetching: railties-4.0.2.gem (100%) 40 Successfully installed railties-4.0.2 41 Fetching: bundler-1.5.2.gem (100%) 42 Successfully installed bundler-1.5.2 43 Fetching: hike-1.2.3.gem (100%) 44 Successfully installed hike-1.2.3 45 Fetching: tilt-1.4.1.gem (100%) 46 Successfully installed tilt-1.4.1 47 Fetching: sprockets-2.10.1.gem (100%) 48 Successfully installed sprockets-2.10.1 49 Fetching: sprockets-rails-2.0.1.gem (100%) 50 Successfully installed sprockets-rails-2.0.1 51 Fetching: rails-4.0.2.gem (100%) 52 Successfully installed rails-4.0.2 53 Parsing documentation for atomic-1.1.14 54 unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/atomic_reference.so, s 55 kipping 56 Installing ri documentation for atomic-1.1.14 57 Parsing documentation for thread_safe-0.1.3 58 Installing ri documentation for thread_safe-0.1.3 59 Parsing documentation for activesupport-4.0.2 60 unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/active_support/values/ 61 unicode_tables.dat, skipping 62 Installing ri documentation for activesupport-4.0.2 63 Parsing documentation for builder-3.1.4 64 C:/Ruby200/lib/ruby/2.0.0/rdoc/parser.rb:87: warning: Unsupported encoding : ign 65 ored 66 C:/Ruby200/lib/ruby/2.0.0/rdoc/parser.rb:87: warning: Unsupported encoding igno 67 red 68 Installing ri documentation for builder-3.1.4 69 Parsing documentation for rack-1.5.2 70 Installing ri documentation for rack-1.5.2 71 Parsing documentation for rack-test-0.6.2 72 Installing ri documentation for rack-test-0.6.2 73 Parsing documentation for erubis-2.7.0 74 Installing ri documentation for erubis-2.7.0 75 Parsing documentation for actionpack-4.0.2 76 Installing ri documentation for actionpack-4.0.2 77 Parsing documentation for activemodel-4.0.2 78 Installing ri documentation for activemodel-4.0.2 79 Parsing documentation for arel-4.0.1 80 Installing ri documentation for arel-4.0.1 81 Parsing documentation for activerecord-deprecated_finders-1.0.3 82 Installing ri documentation for activerecord-deprecated_finders-1.0.3 83 Parsing documentation for activerecord-4.0.2 84 Installing ri documentation for activerecord-4.0.2 85 Parsing documentation for mime-types-1.25.1 86 Installing ri documentation for mime-types-1.25.1 87 Parsing documentation for polyglot-0.3.3 88 Installing ri documentation for polyglot-0.3.3 89 Parsing documentation for treetop-1.4.15 90 Installing ri documentation for treetop-1.4.15 91 Parsing documentation for mail-2.5.4 92 unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/mail/values/unicode_ta 93 bles.dat, skipping 94 Installing ri documentation for mail-2.5.4 95 Parsing documentation for actionmailer-4.0.2 96 Installing ri documentation for actionmailer-4.0.2 97 Parsing documentation for thor-0.18.1 98 Installing ri documentation for thor-0.18.1 99 Parsing documentation for railties-4.0.2 100 Installing ri documentation for railties-4.0.2 101 Parsing documentation for bundler-1.5.2 102 Installing ri documentation for bundler-1.5.2 103 Parsing documentation for hike-1.2.3 104 Installing ri documentation for hike-1.2.3 105 Parsing documentation for tilt-1.4.1 106 Installing ri documentation for tilt-1.4.1 107 Parsing documentation for sprockets-2.10.1 108 Installing ri documentation for sprockets-2.10.1 109 Parsing documentation for sprockets-rails-2.0.1 110 Installing ri documentation for sprockets-rails-2.0.1 111 Parsing documentation for rails-4.0.2 112 unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/aksha 113 ysurve.jpg, skipping 114 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/belon 115 gs_to.png, skipping 116 unable to convert "\xF4" from ASCII-8BIT to UTF-8 for guides/assets/images/book_ 117 icon.gif, skipping 118 unable to convert "\x91" from ASCII-8BIT to UTF-8 for guides/assets/images/bulle 119 t.gif, skipping 120 unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/chapt 121 ers_icon.gif, skipping 122 unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/check 123 _bullet.gif, skipping 124 unable to convert "\xF4" from ASCII-8BIT to UTF-8 for guides/assets/images/credi 125 ts_pic_blank.gif, skipping 126 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/csrf. 127 png, skipping 128 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/edge_ 129 badge.png, skipping 130 unable to convert "\x9E" from ASCII-8BIT to UTF-8 for guides/assets/images/favic 131 on.ico, skipping 132 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/featu 133 re_tile.gif, skipping 134 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/foote 135 r_tile.gif, skipping 136 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/fxn.p 137 ng, skipping 138 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 139 ng_started/challenge.png, skipping 140 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 141 ng_started/confirm_dialog.png, skipping 142 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 143 ng_started/forbidden_attributes_for_new_post.png, skipping 144 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 145 ng_started/form_with_errors.png, skipping 146 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 147 ng_started/index_action_with_edit_link.png, skipping 148 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 149 ng_started/new_post.png, skipping 150 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 151 ng_started/post_with_comments.png, skipping 152 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 153 ng_started/rails_welcome.png, skipping 154 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 155 ng_started/routing_error_no_controller.png, skipping 156 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 157 ng_started/routing_error_no_route_matches.png, skipping 158 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 159 ng_started/show_action_for_posts.png, skipping 160 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 161 ng_started/template_is_missing_posts_new.png, skipping 162 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 163 ng_started/undefined_method_post_path.png, skipping 164 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 165 ng_started/unknown_action_create_for_posts.png, skipping 166 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getti 167 ng_started/unknown_action_new_for_posts.png, skipping 168 unable to convert "\xF0" from ASCII-8BIT to UTF-8 for guides/assets/images/grey_ 169 bullet.gif, skipping 170 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/habtm 171 .png, skipping 172 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_m 173 any.png, skipping 174 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_m 175 any_through.png, skipping 176 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_o 177 ne.png, skipping 178 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_o 179 ne_through.png, skipping 180 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/heade 181 r_backdrop.png, skipping 182 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/heade 183 r_tile.gif, skipping 184 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 185 demo_html_safe.png, skipping 186 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 187 demo_localized_pirate.png, skipping 188 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 189 demo_translated_en.png, skipping 190 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 191 demo_translated_pirate.png, skipping 192 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 193 demo_translation_missing.png, skipping 194 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/ 195 demo_untranslated.png, skipping 196 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 197 /callouts/1.png, skipping 198 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 199 /callouts/10.png, skipping 200 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 201 /callouts/11.png, skipping 202 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 203 /callouts/12.png, skipping 204 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 205 /callouts/13.png, skipping 206 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 207 /callouts/14.png, skipping 208 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 209 /callouts/15.png, skipping 210 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 211 /callouts/2.png, skipping 212 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 213 /callouts/3.png, skipping 214 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 215 /callouts/4.png, skipping 216 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 217 /callouts/5.png, skipping 218 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 219 /callouts/6.png, skipping 220 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 221 /callouts/7.png, skipping 222 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 223 /callouts/8.png, skipping 224 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 225 /callouts/9.png, skipping 226 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 227 /caution.png, skipping 228 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 229 /example.png, skipping 230 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 231 /home.png, skipping 232 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 233 /important.png, skipping 234 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 235 /next.png, skipping 236 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 237 /note.png, skipping 238 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 239 /prev.png, skipping 240 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 241 /tip.png, skipping 242 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 243 /up.png, skipping 244 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons 245 /warning.png, skipping 246 unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/jaime 247 iniesta.jpg, skipping 248 unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/nav_a 249 rrow.gif, skipping 250 unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/oscar 251 delben.jpg, skipping 252 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/polym 253 orphic.png, skipping 254 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/radar 255 .png, skipping 256 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/rails 257 4_features.png, skipping 258 unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/rails 259 _guides_kindle_cover.jpg, skipping 260 unable to convert "\xEC" from ASCII-8BIT to UTF-8 for guides/assets/images/rails 261 _guides_logo.gif, skipping 262 unable to convert "\x8C" from ASCII-8BIT to UTF-8 for guides/assets/images/rails 263 _logo_remix.gif, skipping 264 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/sessi 265 on_fixation.png, skipping 266 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_g 267 rey.gif, skipping 268 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_i 269 nfo.gif, skipping 270 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_n 271 ote.gif, skipping 272 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_r 273 ed.gif, skipping 274 unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_y 275 ellow.gif, skipping 276 unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_y 277 ellow.png, skipping 278 unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/vijay 279 dev.jpg, skipping 280 Installing ri documentation for rails-4.0.2 281 25 gems installed 282 283 C:\Ruby200\bin>
一切完毕,稍微验证一下,就会灿烂地笑了:
C:\Users\Administrator>rails -v
Rails 4.0.2