LinuxCommandLibrary

perlbrew

Manage multiple, isolated Perl installations

TLDR

Initialize a perlbrew environment

$ perlbrew init
copy

List available Perl versions
$ perlbrew available
copy

Install/uninstall a Perl version
$ perlbrew [install|uninstall] [version]
copy

List perl installations
$ perlbrew list
copy

Switch to an installation and set it as default
$ perlbrew switch perl-[version]
copy

Use the system Perl again
$ perlbrew off
copy

List installed CPAN modules for the installation in use
$ perlbrew list-modules
copy

Clone CPAN modules from one installation to another
$ perlbrew clone-modules [source_installation] [destination_installation]
copy

SYNOPSIS

perlbrew [options] command [args]

PARAMETERS

--help, -h
    Show help message.

--version
    Display perlbrew version.

init
    Initialize perlbrew environment (generate bashrc/zshrc).

install release
    Install Perl by release tag (e.g., perl-5.36.0, blead).

list
    List installed Perl versions.

list-known
    List all known releases (deprecated; use available).

available
    Show available Perl releases for install.

switch version
    Switch to version permanently (updates shell profile).

use version
    Use version temporarily in current shell.

off
    Revert to system Perl in current shell.

uninstall version
    Remove installed Perl version.

clone alias=version
    Create alias for existing Perl.

lib command
    Manage local::lib bundles (create, list, etc.).

self-update
    Update perlbrew scripts.

DESCRIPTION

perlbrew is a user-friendly tool for installing and managing multiple Perl interpreters on Unix-like systems like Linux. It allows developers to compile and switch between different Perl versions (e.g., 5.36.0, blead) without affecting the system Perl, avoiding sudo and package manager conflicts.

Key benefits include isolated environments, easy testing across versions, and integration with local::lib for per-Perl module management. Installation is simple via a curl one-liner: curl -kL https://install.perlbrew.pl | bash, followed by perlbrew init and sourcing the bashrc.

Once set up, users install Perls with perlbrew install perl-5.36.0, list them with perlbrew list, switch temporarily via perlbrew use 5.36.0, or permanently with perlbrew switch 5.36.0. It auto-adjusts PATH and MANPATH. Supports patches, mirrors, and cloning Perls.

Ideal for CI/CD, avoiding distro Perls' limitations. Pairs with cpanm for modules: perlbrew lib create myapp then cpanm App::MyApp. Widely used in Perl community for reproducible setups.

CAVEATS

Requires gcc/make and internet for downloads. Compilation takes 5-30 min per Perl. Not for managing modules (use cpanm). Shell profile edits needed for persistence; avoid in non-interactive shells.

INSTALLATION

\curl https://install.perlbrew.pl | bash
\.perlbrew init
Add to ~/.bashrc: source \$HOME/perlbrew/etc/bashrc
Restart shell.

MODULE WORKFLOW

perlbrew lib create myproject
perlbrew use 5.36.0@myproject
cpanm install Module::Name
Modules stay isolated per Perl+lib.

HISTORY

Created by Kang-min Liu (gugod) in March 2010 as a solution for multi-Perl workflows. Gained popularity via Perl community; actively maintained on GitHub with contributions. Key milestones: local::lib integration (2011), self-update (2012), mirrors support.

SEE ALSO

perl(1), cpan(1), make(1), bash(1)

Copied to clipboard