Installing ActivePerl for macOS

You can install the macOS package using the standard user interface, or by using the command line.

Before you begin

Before you start the installation, you need to ensure that your system meets the prerequisites, and that you do not have other Perl distributions installed that might conflict with ActivePerl.

Prerequisites

  • Hardware: 200 MB hard disk space
  • Operating System: macOS 10.9 “Mavericks” or later

Installing with Package

ActivePerl is distributed on macOS as an installer package (.pkg bundle).

  1. Download the ActivePerl installer package (ActivePerl-<version>.pkg) from the ActiveState Platform.
  2. Double-click the ActivePerl installer package (ActivePerl-<version>.pkg) to start the installation.
  3. Follow the Installer prompts. The installer will ask for administrative authentication if the current user does not have administrative privileges.

Installing with the Package command line tool

macOS includes a non-interactive command line interface to Apple’s Installer you can use to install ActivePerl from the command line:

  1. Download the ActivePerl installer package (ActivePerl-<version>.pkg) from the ActiveState platform.

  2. Open Terminal and run Installer using the following syntax:

    $ sudo installer -pkg /Users/<username>/Downloads/ActivePerl-<version>.pkg -target /
    

    Note: It is sometimes useful to create an install log file (e.g. to send to ActiveState technical support). To do this, use the -verbose and -dumplog flags:

    $ sudo installer -pkg /Users/<username>/Downloads/ActivePerl-<version>.pkg \
    -target / -verbose -dumplog > install.log 2>&1
    

More information on the command line interface to Installer can be found by entering man installer in Terminal.

macOS Configuration

The macOS Installer package installs ActivePerl in /usr/local/ActivePerl-5.28. To run the perl interpreter without having to enter the full path, you need to add /usr/local/ActivePerl-5.28/bin to your PATH environment variable. For example:

export PATH=/usr/local/ActivePerl-5.28/bin:$PATH
export PATH=/usr/local/ActivePerl-5.28/site/bin:$PATH

To permanently add the directory to your PATH, add it to the .profile or .bash_profile file in your home directory. For example:

PATH=/usr/local/ActivePerl-5.28/bin:$PATH
PATH=/usr/local/ActivePerl-5.28/site/bin:$PATH
export PATH

Alternatively, you can create symbolic links to the binaries in any bin directory in your PATH to run the perl executables without entering the full path. For example, you could add a bin subdirectory in your home directory to your PATH and create symbolic links:

$ mkdir /Users/<username/bin
$ export PATH=/Users/<username>/bin:$PATH
$ ln -s /usr/local/ActivePerl-5.28/bin/perl /Users/<username>/bin/perl

Verify that you are pointing to the correct ActivePerl executables by entering perl --version.

Uninstalling ActivePerl on macOS

Apple does not provide a standard uninstallation tool or mechanism. You may, however, use the uninstall script that comes with ActivePerl to uninstall ActivePerl:

$ sudo /usr/local/ActivePerl-5.28/bin/ap-uninstall

If necessary, remove any symbolic links, or updates to your .profile or .bash_profile file, added during configuration. For example:

$ rm /Users/<username>/bin/perl