Skip to content

Instantly share code, notes, and snippets.

@simonw
Created June 7, 2018 01:14
Show Gist options
  • Select an option

  • Save simonw/8d19f02f7cade067da88f2f72f9c0ae5 to your computer and use it in GitHub Desktop.

Select an option

Save simonw/8d19f02f7cade067da88f2f72f9c0ae5 to your computer and use it in GitHub Desktop.
Notes on using rbenv to install a gem application without needing root

Notes on using rbenv to install a gem application without needing root

I don't like running sudo gem install X - here's how I installed a gem packaged app without it.

Install rbenv using homebrew

brew install rbenv

Download Ruby 2.5.1 using it

rbenv install 2.5.1

That puts it in ~/.rbenv/versions/2.5.1/

Create a directory

mkdir /tmp/sportsdb
cd /tmp/sportsdb

Activate that version of Ruby for this directory

rbenv local 2.5.1

This creates a .ruby-version file containing 2.5.1

Use gem install to install the gem

gem install sportdb

This installs something clever in ~/.rbenv/shims/sportdb

Now I can run the command I installed

sportdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment