Skip to content

Instantly share code, notes, and snippets.

@pheisiph
Last active April 26, 2016 13:24
Show Gist options
  • Save pheisiph/f18fbb456e92a15059ae to your computer and use it in GitHub Desktop.
Save pheisiph/f18fbb456e92a15059ae to your computer and use it in GitHub Desktop.
Installing Rex on OS X isn't exactly straightforward. This is the best I could come up with.
# rexify OS X - install (R)?ex on OS X
# Installing (R)?ex (http://www.rexify.org) on OS X is a bit more involved
# and the documentation recomends MacPorts (https://macports.org/), even though
# we've collectively moved on towards the excellent Homebrew (http://brew.sh).
# They also suggest using perlbrew (http://perlbrew.pl), but then proceed
# installing Rex globally requiring sudo, which is exactly what perlbrew tries to
# avoid. Luckily Rex is available as a cpan module.
#
# I also installed homebrew in a different directory, in order to support multiple
# users with their own homebrew installation on the same machine, and some of Rex'
# perl-side dependencies don't really like that. See below.
export PERLBREW_ROOT="$HOME/.perl5/perlbrew"
#install perlbrew
\curl -L http://install.perlbrew.pl | bash
# load perlbrew
echo "source $PERLBREW_ROOT/etc/bashrc" >> ~/.bash_profile
source ~/.bash_profile
# Install a perl version. This is going to take a while.
# This installs the latest stable perl verion and activates it immediately.
perlbrew install -j `sysctl -n hw.physicalcpu` --switch stable
# install cpanm to install packages
curl -L https://cpanmin.us | perl - App::cpanminus
# In newer versions of (R)?ex (>= 1.1.0) Net::SSH2 won't be required anymore
# on OS X, thus you can ignore the following steps.
# install dependencies (with homebrew: http://brew.sh) of the dependencies
# brew upgrade libssh2 || brew install libssh2
# # finally
# libssh_path = "$(brew --prefix)/libssh2/$(brew list libssh2 | head -1 | perl -plne '($_) = m/(\d\.\d\.\d)/')"
# LIBSSH2_LIB=`$libssh_path`/lib LIBSSH2_INCLUDE=`$libssh_path`/include cpanm Rex
# generally `capnm Rex` should be enough, but this will accomodate for custom
# homebrew installations with different paths (i.e. if you're running two users
# on the same machine each with their own homebrew installation).
cpanm Rex
# \o/
rex -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment