For some reason today I needed to install both Ruby 2.0.0-p451 and 2.1.1 on OS X Mavericks, using
rbenv. Unfortunately, if you have Homebrew’s
readline package installed (which if you are like me, you probably do, as quite a few other packages depend on it), then there is a conflict that causes a build failure.
This actually is not too difficult, as
rbenv install --patch <version> will accept a patch from
stdin and apply it while building. Juan’s patches, however, will throw a bit of a hiccup as the file paths are prefixed with
fixed/ (because he diffed between two repos), and the application will ask for the correct paths (without the prefixes). This is not a huge deal, but I have some updated gists that prevent it, for 2.0.0-p451 and 2.1.1. You just have to download the patches and send them to
stdin when installing.
Downloading the patch
Well this is what
curl is useful for, given a link, it will download the contents at the specified URL and output them to
stdout. I’m sure
wget would work fine here too. For more info, see
Notice that curl puts the contents it got to its own
rbenv install --patch wants to get the patch from
stdin; this redirection is exactly what shell pipes are for, taking one process’s
stdout and piping it to another’s
curl <ULR> | rbenv install --patch <version>.
- Installing and patching 2.0.0-p451
curl https://gist.githubusercontent.com/andschwa/11334509/raw/f5e459aefafb0e48c62e04ff7da582093fb35233/ruby-2.0-p451-readline.patch | rbenv install --patch 2.0.0-p451
- Installing and patching 2.1.1.
curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1