Installing the Chilkat Perl Module on macOS

The quickest way to install the Chilkat module on macOS, for both Apple Silicon and Intel Macs, is the one-line installer. The manual procedure below it is for machines without internet access, or if you prefer to install from a downloaded package.

Install with one command

The install-perl script reads your Perl's version, CPU architecture (Apple Silicon or Intel), and threading from the perl that runs it, downloads the matching prebuilt module, and installs it into that same perl. There is no compiler step and no make, and because the perl that runs the script is the perl the module goes into, the version and threading always match.

curl -fsSL https://chilkatdownload.com/perl/install-perl | perl -

# no curl?  wget works the same way
wget -qO- https://chilkatdownload.com/perl/install-perl | perl -
sudo may be required The installer writes into your Perl's site library. For the macOS system perl (/usr/bin/perl) that directory is owned by root, so the command needs sudo; a Homebrew or perlbrew perl is normally writable by you and needs none. The script checks first and says so if it cannot write there. Without root, add --local to install under ~/perl5 for your user only (the script then prints the PERL5LIB setting to use):
# with curl
curl -fsSL https://chilkatdownload.com/perl/install-perl | sudo perl -
# with wget
wget -qO- https://chilkatdownload.com/perl/install-perl | sudo perl -

# per-user, no root needed
curl -fsSL https://chilkatdownload.com/perl/install-perl | perl - --local
Note that under sudo, a bare perl is the system perl. If you use another perl and it does need root, name it explicitly:
curl -fsSL https://chilkatdownload.com/perl/install-perl | sudo /opt/homebrew/bin/perl -
Using cpanm? The module is also available as a CPAN distribution, from Chilkat's own repository rather than from CPAN itself, so tell cpanm where to look:
cpanm --mirror https://chilkatdownload.com/cpan --mirror-only Chilkat
It fetches the same prebuilt package at configure time and installs it through MakeMaker, so cpanm's usual options apply: --sudo when the site library needs root, or -l ~/perl5 for a per-user install; cpanm --uninstall Chilkat removes it. A specific release can be installed from its URL, cpanm https://chilkatdownload.com/cpan/authors/id/C/CH/CHILKAT/Chilkat-<version>.tar.gz.

Other options: --dry-run shows what would be detected and installed without changing anything; --from <file> installs from an already-downloaded .tar.gz; --version 11.6.0 selects a particular Chilkat release. The script finishes by loading the module in a fresh perl and printing the Chilkat version, so OK: 'use chilkat' loads means you are done. Apple Silicon builds exist for Perl 5.34 and later.

No Gatekeeper step The installer fetches the package directly rather than through a browser, so the library carries no quarantine attribute and the xattr step described below is not needed.

Manual install from a downloaded package

For machines without internet access, or if you prefer to download the package yourself. (With the package downloaded, perl install-perl --from chilkat-perl-<version>-<arch>-macosx.tar.gz also works in place of steps 4–7.)

Pick the right download for your Mac The Chilkat module is a prebuilt native library, so the download must match your system on three points:
  • CPU architecture: arm64 for Apple Silicon (M-series), or x86_64 for Intel Macs.
  • Perl version: it must match the 5.xx of your Perl.
  • Threading: a threaded Perl needs the thread-multi download; a non-threaded Perl needs the regular download (see Step 3).
  1. Download

    Get the build for your Mac from the Chilkat macOS Perl Downloads.

  2. What's in the download

    The .tar.gz contains:

    chilkat-perl-<version>-<arch>-macosx/
    ├─ lib/
    │   ├─ chilkat.pm              the Perl module
    │   └─ libchilkat.dylib        the compiled Chilkat library
    ├─ Makefile.PL                 build script (ExtUtils::MakeMaker)
    ├─ MANIFEST
    ├─ META.yml
    ├─ testChilkat.pl              a test script
    ├─ license.pdf
    ├─ pcre2-license.pdf
    ├─ quickjs-license.pdf
    └─ THIRD-PARTY-NOTICES.txt
  3. Match your architecture, Perl version, and threading

    Confirm the download matches your system:

    # CPU architecture (arm64 = Apple Silicon, x86_64 = Intel)
    uname -m
    
    # Perl version (must match the download's 5.xx)
    perl -version
    
    # Threaded Perl? "define" = use the thread-multi download
    perl -V:useithreads

    If useithreads='define', download the thread-multi build; otherwise download the regular build. See Thread-Multi or Non-Threaded? for details.

  4. Extract to any directory

    tar xzf chilkat-perl-<version>-<arch>-macosx.tar.gz
  5. Build

    In the newly-created directory:

    perl Makefile.PL
    make

    The library is prebuilt, so this only generates and runs a Makefile that stages the files — there is no C compilation of Chilkat itself.

  6. Install

    Still in the same directory:

    make install
    # or, if you need elevated permissions:
    sudo make install

    You need write permission to your Perl library directory — installing system-wide usually requires root.

  7. Test

    Run the included testChilkat.pl to confirm the module loads:

    perl testChilkat.pl

    It creates several Chilkat objects and prints the version of each:

    use chilkat();
    
    my $zip = new chilkat::CkZip();
    print $zip->version() . "\r\n";
    
    my $http = new chilkat::CkHttp();
    print $http->version() . "\r\n";
    # ... (the script creates several more Chilkat objects)

    If it prints the Chilkat version, the module is installed correctly.


macOS Gatekeeper: “libchilkat.dylib cannot be opened”

This applies to packages downloaded with a browser (the one-line installer is not affected). Because such a .dylib arrives with a quarantine attribute, macOS Gatekeeper may block it with a message such as “libchilkat.dylib” cannot be opened because the developer cannot be verified. Remove the quarantine attribute from the extracted folder:

xattr -dr com.apple.quarantine chilkat-perl-<version>-<arch>-macosx

Then build and install as above. (You can also clear it from just the library: xattr -d com.apple.quarantine lib/libchilkat.dylib.)


Multiple Perls? If you use Perl from brew, perlbrew, or the system, make sure you build, install, and run with the same one — confirm with which perl. Each may differ in version and threading. The one-line installer sidesteps this: it installs into whichever perl runs it, so pipe it into the perl you use (curl -fsSL ... | /opt/homebrew/bin/perl -).