Skip to content

Instantly share code, notes, and snippets.

@denji
Last active February 6, 2024 08:52
Show Gist options
  • Star 58 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save denji/8706676 to your computer and use it in GitHub Desktop.
Save denji/8706676 to your computer and use it in GitHub Desktop.
Homebrew + RVM > Awesome

The MBP is my development machine, so I needed all of my tools installed with the ability to update them with ease. In the past, I used MacPorts to take care of my MySQL, Memcached, and Ruby installions and it worked just fine. This time around however, I wanted something new and fun. Homebrew.

Homebrew is a new package manager for OS X. Unlike Fink or MacPorts, Homebrew integrates with the core operating system, reducing the number of extra libraries to install etc. Another neat feature is the ability to write software package recipes in Ruby, awesome.

Here are some raw installation instructions (clean system). I like to keep everything under user ownership to make life more enjoyable, say no to sudo.

You will need the latest version of xcode, you can get it here. After the installation is complete, you may continue.

sudo mkdir /usr/local
sudo chown -R $USER /usr/local
curl -Lsf \
http://github.com/mxcl/homebrew/tarball/master | \
tar xvz -C /usr/local --strip 1
brew install git
brew update
brew install wget
brew install mysql
brew install memcached
brew install postgres
brew install redis
brew install mongodb
brew list

My homebrew experience has been a happy one, I don’t see myself using MacPorts or Fink again.

Homebrew documentation can be found here.

RVM (Ruby Version Manager) takes care of managing my multiple Ruby and Gem versions. Leaving the OS X default installation of ruby alone, RVM installs to a users home directory, changing the required system variables. Just how Homebrew is under user ownership, RVM is quite happy running this way as well and so am I.

To install RVM, do the following.

mkdir -p ~/.rvm/src && cd ~/.rvm/src && rm -rf ./rvm && \
git clone --depth 1 https://github.com/rvm/rvm.git && \
cd rvm && ./install

Add the following line to the end of your .profile or .bash_profile or .bashrc file.

if [[ -s $HOME/.rvm/scripts/rvm ]]; then
  source $HOME/.rvm/scripts/rvm;
fi
Try out RVM.
rvm install 1.8.7
rvm install 1.9.2
rvm --default 1.9.2
ruby -v
which ruby
gem install rails

Pretty neat eh? (I’m Canadian, it’s ok) RVM documentation can be found here.

@toklok
Copy link

toklok commented Apr 14, 2016

Hey, thanks for writing this.

@SurenderLohia
Copy link

SurenderLohia commented Aug 3, 2016

Great!

Copy link

ghost commented Oct 25, 2016

I believe you have to source the file before you can use rvm to install a Ruby version.

@matthewhartman
Copy link

matthewhartman commented Feb 13, 2018

Thanks for sharing.

One small tweak:

mkdir -p ~/.rvm/src && cd ~/.rvm/src && rm -rf ./rvm && \
git clone --depth 1 git://github.com/rvm/rvm.git && \
cd rvm && ./install

Cheers.

@jhmarina
Copy link

Thanks for sharing this, it was pretty useful!

@lemin-ou
Copy link

Thank you for the help.
Pretty neat LOL

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