Install PEAR on macOS 10.15 Catalina

Raptor Kwok
1 min readSep 9, 2020

--

macOS now no longer ships with PEAR, but installation is quite easy.

Prerequisites

  1. Homebrew (install instructions)
  2. autoconf: use command: brew install autoconf
  3. Xcode command-line tools: xcode-select --install

Install PEAR

cd /tmp
curl -s -O https://pear.php.net/install-pear-nozlib.phar
sudo php install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin

Upgrade PEAR

sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all --ignore-errors

Configure PHP

First, you have to find out which php.ini you’re using.

php --ini

Find the “Loaded Configuration File:” line. If no php.ini file is loaded, you can create one at /etc/php.ini with the following contents:

include_path = ".:/usr/local/lib/php/pear"

You can double confirm the newly created php.ini is loaded by issuing the second last command.

Update PEAR and PECL channels

After a fresh installation, channels need to be updated.

sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net

Done!

You can now use the PEAR and PECL.

Questions?

Please leave a comment below.

--

--

Raptor Kwok

I write stuffs: novels, programs, mobile apps, journal papers, book chapters, etc.