Skip to content

Instantly share code, notes, and snippets.

@gr4y
Created May 4, 2013 09:53
Show Gist options
  • Select an option

  • Save gr4y/5517010 to your computer and use it in GitHub Desktop.

Select an option

Save gr4y/5517010 to your computer and use it in GitHub Desktop.

Revisions

  1. gr4y created this gist May 4, 2013.
    45 changes: 45 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #
    # 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