Last Updated: February 25, 2016
·
1.194K
· void

Rails development environment using rbenv+ruby-build+bundler

Make sure that you removed rvm, becouse rbenv conflicts with rvm:
bash $ rm -rf ~/.rvm ~/.rvmrc

Install rbenv+ruby-build
bash $ brew install rbenv ruby-build

Install ruby
List of available rubys available through rbenv install --list
bash $ brew install openssl && CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" && rbenv install 2.0.0-dev

Set installed ruby globally
bash $ rbenv global 2.0.0-dev

Install bundler
bash $ gem install bundler && rbenv rehash

Remember to rerun rbenv rehash after installation of gems which have binaries

Create gemset using bundler
bash $ mkdir ror_proj $ cd ror_proj $ echo "gem 'rails'" > Gemfile $ mkdir -p vendor/bundle $ bundle install --path vendor/bundle

Create some aliases
bash $ echo 'alias bi="bundle install --path vendor/bundle"' >> ~/.bash_profile $ echo 'alias begem="bundle exec gem"' >> ~/.bash_profile $ echo 'alias berake="bundle exec rake"' >> ~/.bash_profile $ echo 'alias berails="bundle exec rails"' >> ~/.bash_profile $ echo 'alias becap="bundle exec cap"' >> ~/.bash_profile

Create rails app
bash $ cd .. && berails ror_proj --gemfile=ror_proj/Gemfile

Start created app
$ cd ror_proj && berails server