Mac上にRuby環境を構築する手順。(rbenv使用)
- homebrew で rbenv をインストール。
1 |
$ brew install rbenv ruby-build |
- .zshrc に以下を追加。
1 |
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi |
- rubyのインストール
1 2 3 4 5 6 7 8 9 10 11 |
$ source .zshrc # インストール可能なrubyのリストを表示 $ rbenv install -l # インストール $ rbenv install 2.1.3 # リンクの更新 $ rbenv global 2.1.3 $ rbenv rehash |
- 確認
1 2 3 4 5 6 |
$ ruby --version ruby 2.1.3p242 ..... $ which ruby /Users/<User Name>/.rbenv/shims/ruby $ which gem /Users/<User Name>/.rbenv/shims/gem |
- 補足。bundlerは多分頻繁につかうので、インストール
1 2 |
$ rbenv exec gem install bundler $ rbenv rehash |
コメント