Windows搭建Ruby环境

安装rubyhttp://rubyinstaller.org/downloads/
(比如Ruby 2.1.8-x64.exe

bin(比如C:\Ruby21-x64\bin )加入环境变量PATH

安装 DevKithttp://rubyinstaller.org/downloads/
解压到 C:\Ruby21-x64\DevKit

cd C:\Ruby21-x64\DevKit
ruby dk.rb init

编辑config.yml

---

- C:/Ruby21-x64
ruby dk.rb install

配置gem

gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.org/

如果遇到SSL验证问题:

Error fetching https://gems.ruby-china.org/:
    SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://gems.ruby-china.org/specs.4.8.gz)

方法一,https换成http
方法二,下载http://curl.haxx.se/ca/cacert.pembinC:\Ruby21-x64\bin),并设置系统环境变量SSL_CERT_FILE = C:\Ruby21-x64\bin\cacert.pem

安装bundler

gem install bundler

配置源:

bundle config mirror.https://rubygems.org https://gems.ruby-china.org/

你可能感兴趣的:(Ruby学习笔记)