Ruby
{% include JB/setup %}
Install Ruby
Ubuntu
sudo apt-get install git ruby1.9.1 ruby1.9.1-dev make rake
ruby --version
macOS
brew install git ruby ruby-build make
ruby --version
gem environment
Method 1 (Recommended)
Add to ~/.zshrc
plugins=(ruby)
Method 2
Copy EXECUTABLE DIRECTORY
: /usr/local/Cellar/ruby/2.2.2/bin
Add /usr/local/Cellar/ruby/2.2.2/bin
to PATH
in ~/.zshrc
Use Taobao RubyGems Mirror
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l
# Ensure only ruby.taobao.org
sudo gem update --system
Install rbenv
brew install rbenv
type rbenv
Configure
Method 1 (Recommended)
Add to ~/.zshrc
plugins=(rbenv)
Method 2
Add $HOME/.rbenv/bin
to PATH
in ~/.zshrc
Add to ~/.zshrc
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Install Version
rbenv install -l
rbenv install 2.2.2