LoginSignup
2
2

More than 5 years have passed since last update.

rbenv + Ruby + Ruby On Railsのインストール方法

Last updated at Posted at 2015-02-12

rbenv

  • rbenvのインストール
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  • .rbenv/binにPATHを通す
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
  • .rbenv/shimsにPATHを通す
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~./bash_profile
rbenv -v (確認)
  • rbenvを最新版にする
cd ~/.rbenv
git pull
  • rbenv rehashの自動化
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

rubyのインストール

  • ruby-buildをインストール
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-buil
  • ruby-buildを最新版にする
cd ~/.rbenv/plugins/ruby-build
git pull
  • rubyのバージョン確認
ruby install -l
  • rubyのインストール
rbenv install "インストールしたいversion" 
(ex. rbenv install 2.2.0)
  • rubyのバージョンの切り替え
rbenv global "切り替えたいバージョン"
(ex. rbenv global 2.2.0)
rbenv versions (確認)

Ruby on railsのインストール

  • bundlerのインストール
    • ruby1.9以降はgemが初期装備
    • ruby1.9より前の場合はこちらからインストール
gem install bundler
bundle -v
  • 編集中

その他

bundle execをしなくても良くなる方法

注意点

  • rbenvとrvmは同時にインストール出来ないので、rvmが入っている場合はアンインストールをすること

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2