Skip to content

Instantly share code, notes, and snippets.

@gr4y
Created May 4, 2013 09:53
Show Gist options
  • Save gr4y/5517010 to your computer and use it in GitHub Desktop.
Save gr4y/5517010 to your computer and use it in GitHub Desktop.
How I setup my ruby environment:
#
# This is the way I configured my ruby environment on ArchLinux.
#
# I don't like the overhead of rvm, so I use chruby to switch between ruby versions.
# So first you need to install chruby from source:
#
# https://github.com/postmodern/chruby#install
#
# To build ruby from source I use ruby-build, so after chruby we install ruby-build:
#
# https://github.com/sstephenson/ruby-build#installing-as-a-standalone-program-advanced
# you need an root shell
sudo -s
# add an ruby group
groupadd ruby
# add your user to the ruby group (don't forget to add your username here
gpasswd -a $YOUR_USERNAME ruby
# now we create the place where all our ruby versions live
mkdir /opt/rubies
# set the ownership of that directory to root:ruby
chown root:ruby /opt/rubies
# make that directory group writable
chmod g+rws /opt/rubies
ruby-build 1.9.3-p392 /opt/rubies/ruby-1.9.3-p392
ruby-build 2.0.0-p0 /opt/rubies/ruby-2.0.0-p0
# now add chruby.sh to your .bash_profile
echo "source /usr/local/share/chruby/chruby.sh" > /etc/profile.d/chruby.sh
# make it executable, to execute it every time you open an new shell
chmod +x /etc/profile.d/chruby.sh
# to make chruby available in the current shell
source /etc/profile.d/chruby.sh
# if you want to set an default ruby with every login, add it to your profile
echo "chruby 2.0.0-p0" >> .profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment