Skip to content

Instantly share code, notes, and snippets.

@denvazh
Created November 24, 2015 07:14
Show Gist options
  • Save denvazh/9535921004d7208dd275 to your computer and use it in GitHub Desktop.
Save denvazh/9535921004d7208dd275 to your computer and use it in GitHub Desktop.
Ruby development environment with rbenv and bundler

Ruby

Rbenv

Used to manage ruby environment, since it is more beneficial and clean to use non-system one.

Install rbenv and ruby-build

brew install rbenv ruby-build rbenv-vars

Add to .zshrc (or .bashrc) the following:

export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

Restart shell session. (close shell tab or window and open again).

Ruby

Install Ruby interpreter

rbenv install 2.2.3
rbenv rehash

Use newely installed Ruby 2.2.3 by default

rbenv global 2.3.3

Install bundler system-wide

gem install bundler

Bundler

By default move executables installed by bundler to .bin dir

bundle config bin .bin --global

By default install bundler dependencies to vendor/bundle

bundle config path vendor/bundle --global

Add .bin to PATH, so that it would be possible to run commands without bundle exec

export PATH=".bin:$PATH"

To make gem command aware of application specific dependencies, create /usr/local/var/rbenv/vars with the following contents

GEM_PATH=vendor/bundle

Intellij IDEA

Make it aware of rbenv

ln -s /usr/local/var/rbenv ~/.rbenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment