Railsで、rbenv,rvm,chrubyなどを使わずにBundlerを使う

Post date: 2014/06/28 2:38:40

rubyは、ruby_buildなどで入れるのが簡単

適当な場所で、git clone https://github.com/sstephenson/ruby-build.git; cd ruby-build/; ./install.sh

ruby-build --definitions で、どんなバージョンがあるか調べ

ruby-build 2.0.0-p481 /opt/rubies/2.0.0-p481

これで、/opt/rubies/2.0.0-p481/bin/ruby が入る

export PATH=/opt/rubies/2.0.0-p481/bin:$PATH して、ruby 2.0 を使えるようにする

export GEM_HOME=/opt/rubies/2.0.0-p481/lib/ruby/gems/2.0.0

さらに、export PATH=$GEM_HOME/bin:$PATH することで、bundleコマンドなどが正しく使える(これはウソっぽい)

gem install bundler

これで、/opt/rubies/2.0.0-p481/lib/ruby/gems/2.0.0/gemsにgemが入るようになる

また、/opt/rubies/2.0.0-p481/lib/ruby/gems/2.0.0/gems/bin の下に、bundle, bundlerが入るのだと思っていたが、これは間違い。

bundle,bundlerなどは、/opt/rubies/2.0.0-p481/binにはいっていた。

動作確認:Railsのディレクトリで

bundle install --without=test,development

bundle exec rails s -e production