Skip to content

Files

Latest commit

author
jgreely
Feb 27, 2019
23aadc6 · Feb 27, 2019

History

History
This branch is 124 commits behind sb2nov/mac-setup:main.

Perl

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 27, 2019

Perl

macOS ships with Perl, but it's not safe to rely on it for more than basic one-liners. Apple has broken it twice, and let it go very stale at least once. Many packages distributed with Homebrew depend on the version of Perl it installs, but for complete control of what version you're running and what packages are installed, there's also Perlbrew.

There are several methods of installing modules from the Comprehensive Perl Archive Network (CPAN), but the easiest is cpanminus (cpanm).

Installation

Homebrew

$ brew install perl cpanminus

Perlbrew

$ curl -L https://install.perlbrew.pl | bash

$ source ~/perl5/perlbrew/etc/bashrc
$ perlbrew install-cpanm
$ perlbrew install --switch stable

$ echo source ~/perl5/perlbrew/etc/bashrc >> ~/.bash_profile

Other useful commands:

# full documentation
$ perlbrew help

# override version in current shell
$ perlbrew use $version

# execute a script with a specific version
$ perlbrew exec $version $script

# revert to vendor/Homebrew Perl in current shell
$ perlbrew off

# reinstall all modules in a different version
$ perlbrew clone-modules $from $to

Usage

To install additional modules from CPAN:

$ cpanm Modern::Perl

Customization

You can set the environment variable PERLBREW_ROOT to override the default installation directory.