Installing Ruby with rbenv on Debian
02 April 2013
Quick guide to installing Ruby versions on Debian using rbenv
- Ensure dependencies are installed using
apt-get install gcc make zlib1g zlib1g-dev
- If you want to use the version of git from Debian and don’t have that installed yet then install that too:
apt-get install git
- Clone rbenv from GitHub:
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
- Install the ruby-build plugin:
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
- Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
- Enable shims and command line autocompletion:
echo 'eval "$(rbenv init -)"' >> ~/.profile
- Restart your shell
- Install ruby: e.g.
rbenv install 1.9.3-p392
- Rebuild the shim executables:
rbenv rehash
- Set the rbenv global version of Ruby to the one just installed: e.g.
rbenv global 1.9.3-p392
After installing, if you get the error no such file to load -- zlib (LoadError)
when trying to install any gems this is likely because you are missing zlib1g or zlib1g-dev. You will need to apt get install zlib1g zlib1g-dev
and then recompile Ruby again by rerunning rbenv install
.
About this Site
SDJournal is Michael Josephson's
personal site for posting notes about programming and the software development process
along with related links and code snippets.
Contact
Email: