Fork me on github!!

Deploying Perl bindings from tools installed with Homebrew on OS X

by Lieven Hollevoet @hollie

I have been using Perlbrew happily on OS X to install custom/recent Perl versions. Sometimes I need a more or less exotic Perl binding that I could easily install using Homebrew. Recent updates to Homebrew made that process a bit less automatic.

Below I describe how to install the perl-shared binding for RRDTool on a recent OS X with a recent version of Homebrew.

Why is it not working automatically

There are two issues with the combination of Perlbrew and Homebrew: Homebrew assumes you're using the system Perl and does not automatically detect your locally-installed Perl. Latest versions of Homebrew work in a sandbox environment. This means that the build chain has no write permissions to the folder that contains the Perlbrew site modules.

Detect locally-installed Perl version

This can be forced by passing to brew the option --env=std. For more information and the discussion about this please see the last posts in this support ticket.

Work around the sandbox

When you're install a packet with brew, the sandbox seems to prohibit writes to other folders than the target folder for the brew process. This means that if a packet creates a Perl module, this module cannot be written to the Perl site module folder. To work around that: enable the option to not delete the build folder navigate to the build folder yourself and install the perl module.

Practical example for RRDtool

brew install --env=std --build-from-source --keep-tmp rrdtool

Then navigate to the temp folder where the build results are retained. The full path is listed in the output of the previous command.

Go into the subfolder bindings/perl-shared and do make install there. You'll see the nicely be deployed into your favorite Perl version module folder.


I've discussed this with a developer from Homebrew.