Skip to content

Instantly share code, notes, and snippets.

@whisk
Last active March 10, 2017 17:39
Show Gist options
  • Save whisk/166cbbf0eaaaaeb8e04d4057091d03f4 to your computer and use it in GitHub Desktop.
Save whisk/166cbbf0eaaaaeb8e04d4057091d03f4 to your computer and use it in GitHub Desktop.
Installing rbenv system-wide with RubyMine and Vagrant support
  1. Follow the instructions to install rbenv system-wide (for Vagrant support you do it in the box):
# create user and groups for rbenv
useradd -U rbenv || true
usermod -G rbenv -a vagrant # add vagrant to rbenv group; discard if you are not using Vagrant

# install rbenv itself
git clone https://github.com/rbenv/rbenv.git /usr/local/rbenv
cd /usr/local/rbenv && ./src/configure && make -C src || true

# system-wide profile for all users
echo 'export PATH="/usr/local/rbenv/bin:$PATH"' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT="/usr/local/rbenv"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh

# add ruby-build plugin
git clone https://github.com/rbenv/ruby-build.git /usr/local/rbenv/plugins/ruby-build
chgrp -R rbenv /usr/local/rbenv
chmod -R g+rwxXs /usr/local/rbenv

# load profile (you may also reload your shell)
source /etc/profile.d/rbenv.sh

# install a required ruby version
rbenv install 2.3.1
rbenv global 2.3.1

# you will need bundler
gem install bundler

# required for RubyMine support
# see: https://www.jetbrains.com/help/ruby/2016.3/rbenv-support.html
ln -s /usr/local/rbenv /home/vagrant/.rbenv
  1. Bundle your project gems locally -- this may be critical to RubyMine:
bundle install --path vendor/bundle
  1. Open RubyMine, go to Preferences -> Languages & Frameworks -> Ruby SDK and Gems. Press 'Add', select 'Vagrant', use path to your ruby binary under versions/ (not shims/!). RubyMine should detect your gems.
  2. You are awesome!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment