Install Pecl on Mac

To install PECL on your mac, use curl as shown below to download the go-pear.phar file or just download the go-pear.phar file via your browser.

$ curl -O https://pear.php.net/go-pear.phar
$ php -d detect_unicode=0 go-pear.phar

You’re now ready to configure PEAR for installation.

First you need to change the Installation Base.

  1. So type 1, and then press Enter.
  2. Enter /usr/local/pear
  3. Press Enter.

Then, you will need to change the Binaries directory.

  1. Type 4, and then press Enter.
  2. Enter /usr/local/bin
  3. Press Enter.

Once you have changed the Installation Base and the Binaries Directory, press Enter to install PEAR.

Install Pear Globally

For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.

$ curl -O https://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

2 thoughts on “Install Pecl on Mac”

  1. Error after error after error to fail to install a package manager for a library for an extension that is supposed to be standard. Why is Unix such a freaking mess? IT HAS BEEN THIRTY YEARS SINCE MAC USERS COULD INSTALL SOFTWARE THAT “JUST WORKED” – WHAT THE HELL HAPPENED?????

    jwb@MacBookAi7r ~ % pecl install libsodium
    WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
    downloading libsodium-2.0.23.tgz …
    Starting to download libsodium-2.0.23.tgz (28,505 bytes)
    ………done: 28,505 bytes
    4 source files, building
    running: phpize
    grep: /usr/include/php/main/php.h: No such file or directory
    grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
    grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
    Configuring for:
    PHP Api Version:
    Zend Module Api No:
    Zend Extension Api No:
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.

    ERROR: `phpize’ failed
    jwb@MacBookAi7r ~ % pecl channel-update pecl.php.net
    Updating channel “pecl.php.net”
    Update of Channel “pecl.php.net” succeeded
    jwb@MacBookAi7r ~ % pecl install libsodium
    downloading libsodium-2.0.23.tgz …
    Starting to download libsodium-2.0.23.tgz (28,505 bytes)
    ………done: 28,505 bytes
    4 source files, building
    running: phpize
    grep: /usr/include/php/main/php.h: No such file or directory
    grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
    grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
    Configuring for:
    PHP Api Version:
    Zend Module Api No:
    Zend Extension Api No:
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.

    ERROR: `phpize’ failed
    jwb@MacBookAi7r ~ % brew install autoconf
    Running `brew update –preinstall`…
    ==> Auto-updated Homebrew!
    Updated 1 tap (homebrew/core).
    ==> Updated Formulae
    Updated 1 formula.

    ==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:e0fec6a49fd80cc7279c71f319d70d01ed49e894b53cd91e39f170288232fa93
    ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:e0fec6a49fd80cc7279c71f319d70d01ed49e894b53cd91e39f170288232fa93?se=2022-03-12T05%3
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.71
    ######################################################################## 100.0%
    ==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:258a94bef23057c52818adf64d682af20bc6e09b46eac135047e2b87fc8206c7
    ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:258a94bef23057c52818adf64d682af20bc6e09b46eac135047e2b87fc8206c7?se=2022-03-12T05%3
    ######################################################################## 100.0%
    ==> Installing dependencies for autoconf: m4
    ==> Installing autoconf dependency: m4
    ==> Pouring m4–1.4.19.catalina.bottle.tar.gz
    🍺 /usr/local/Cellar/m4/1.4.19: 13 files, 724.4KB
    ==> Installing autoconf
    ==> Pouring autoconf–2.71.catalina.bottle.tar.gz
    🍺 /usr/local/Cellar/autoconf/2.71: 71 files, 3.2MB
    ==> Running `brew cleanup autoconf`…
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    jwb@MacBookAi7r ~ % pecl install libsodium
    downloading libsodium-2.0.23.tgz …
    Starting to download libsodium-2.0.23.tgz (28,505 bytes)
    ………done: 28,505 bytes
    4 source files, building
    running: phpize
    grep: /usr/include/php/main/php.h: No such file or directory
    grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
    grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
    Configuring for:
    PHP Api Version:
    Zend Module Api No:
    Zend Extension Api No:
    configure.ac:7: warning: $as_echo is obsolete; use AS_ECHO([“message”]) instead
    aclocal.m4:2696: PHP_CONFIG_NICE is expanded from…
    configure.ac:7: the top level
    configure.ac:149: warning: The macro `AC_LANG_C’ is obsolete.
    configure.ac:149: You should run autoupdate.
    ./lib/autoconf/c.m4:72: AC_LANG_C is expanded from…
    aclocal.m4:6054: _LT_AC_LANG_C_CONFIG is expanded from…
    aclocal.m4:6053: AC_LIBTOOL_LANG_C_CONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: The macro `AC_LANG_C’ is obsolete.
    configure.ac:149: You should run autoupdate.
    ./lib/autoconf/c.m4:72: AC_LANG_C is expanded from…
    lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from…
    lib/m4sugar/m4sh.m4:699: AS_IF is expanded from…
    ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from…
    ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from…
    aclocal.m4:3888: _LT_AC_LOCK is expanded from…
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6054: _LT_AC_LANG_C_CONFIG is expanded from…
    aclocal.m4:6053: AC_LIBTOOL_LANG_C_CONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: The macro `AC_TRY_LINK’ is obsolete.
    configure.ac:149: You should run autoupdate.
    ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from…
    lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from…
    lib/m4sugar/m4sh.m4:699: AS_IF is expanded from…
    ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from…
    ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from…
    aclocal.m4:3888: _LT_AC_LOCK is expanded from…
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6054: _LT_AC_LANG_C_CONFIG is expanded from…
    aclocal.m4:6053: AC_LIBTOOL_LANG_C_CONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC’ does not support \`-c -o’, so \`make -j’ may be unsafe
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6054: _LT_AC_LANG_C_CONFIG is expanded from…
    aclocal.m4:6053: AC_LIBTOOL_LANG_C_CONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC’ does not support \`-c -o’, so \`make -j’ may be unsafe
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6054: _LT_AC_LANG_C_CONFIG is expanded from…
    aclocal.m4:6053: AC_LIBTOOL_LANG_C_CONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile’ does not exist
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile’ does not exist
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile’ does not look like a libtool script
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile’ does not look like a libtool script
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC’, extracted from \`$ofile’
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC’, extracted from \`$ofile’
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: tag name \”$tagname\” already exists
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: The macro `AC_LANG_CPLUSPLUS’ is obsolete.
    configure.ac:149: You should run autoupdate.
    ./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from…
    aclocal.m4:6136: _LT_AC_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:6135: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC’ does not support \`-c -o’, so \`make -j’ may be unsafe
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6136: _LT_AC_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:6135: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC’ does not support \`-c -o’, so \`make -j’ may be unsafe
    aclocal.m4:4511: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from…
    aclocal.m4:6136: _LT_AC_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:6135: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from…
    aclocal.m4:5244: _LT_AC_TAGCONFIG is expanded from…
    aclocal.m4:3397: AC_LIBTOOL_SETUP is expanded from…
    aclocal.m4:3379: _AC_PROG_LIBTOOL is expanded from…
    aclocal.m4:3366: AC_PROG_LIBTOOL is expanded from…
    configure.ac:149: the top level
    building in /private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23
    running: /private/tmp/pear/install/libsodium/configure –with-php-config=/usr/bin/php-config
    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for a sed that does not truncate output… /usr/bin/sed
    checking for cc… cc
    checking whether the C compiler works… yes
    checking for C compiler default output file name… a.out
    checking for suffix of executables…
    checking whether we are cross compiling… no
    checking for suffix of object files… o
    checking whether the compiler supports GNU C… yes
    checking whether cc accepts -g… yes
    checking for cc option to enable C11 features… none needed
    checking how to run the C preprocessor… cc -E
    checking for icc… no
    checking for suncc… no
    checking whether cc understands -c and -o together… yes
    checking for system library directory… lib
    checking if compiler supports -R… no
    checking if compiler supports -Wl,-rpath,… yes
    checking build system type… x86_64-apple-darwin19.6.0
    checking host system type… x86_64-apple-darwin19.6.0
    checking target system type… x86_64-apple-darwin19.6.0
    checking for PHP prefix… /usr
    checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
    checking for PHP extension directory… /usr/lib/php/extensions/no-debug-non-zts-20180731
    checking for PHP installed headers prefix… /usr/include/php
    checking if debug is enabled… no
    checking if zts is enabled… no
    checking for re2c… no
    configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
    checking for gawk… no
    checking for nawk… no
    checking for awk… awk
    checking if awk is broken… no
    checking for sodium support… yes, shared
    checking for pkg-config… no
    checking for libsodium… found in /usr/local
    checking for sodium_add in -lsodium… yes
    checking for ld used by cc… /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld… no
    checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files… -r
    checking for BSD-compatible nm… /usr/bin/nm -B
    checking whether ln -s works… yes
    checking how to recognize dependent libraries… pass_all
    checking for stdio.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for strings.h… yes
    checking for sys/stat.h… yes
    checking for sys/types.h… yes
    checking for unistd.h… yes
    checking for dlfcn.h… yes
    checking the maximum length of command line arguments… 196608
    checking command to parse /usr/bin/nm -B output from cc object… ok
    checking for objdir… .libs
    checking for ar… ar
    checking for ranlib… ranlib
    checking for strip… strip
    checking for dsymutil… dsymutil
    checking for nmedit… nmedit
    checking for -single_module linker flag… yes
    checking for -exported_symbols_list linker flag… yes
    checking if cc supports -fno-rtti -fno-exceptions… yes
    checking for cc option to produce PIC… -fno-common
    checking if cc PIC flag -fno-common works… yes
    checking if cc static flag -static works… no
    checking if cc supports -c -o file.o… yes
    checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries… yes
    checking dynamic linker characteristics… darwin19.6.0 dyld
    checking how to hardcode library paths into programs… immediate
    checking whether stripping libraries is possible… yes
    checking if libtool supports shared libraries… yes
    checking whether to build shared libraries… yes
    checking whether to build static libraries… no

    creating libtool
    appending configuration tag “CXX” to libtool
    configure: creating ./config.status
    config.status: creating config.h
    running: make
    /bin/sh /private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23/libtool –mode=compile cc -I. -I/private/tmp/pear/install/libsodium -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23/include -I/private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23/main -I/private/tmp/pear/install/libsodium -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/libsodium/libsodium.c -o libsodium.lo
    mkdir .libs
    cc -I. -I/private/tmp/pear/install/libsodium -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23/include -I/private/tmp/pear/install/pear-build-jwbeuKt6d/libsodium-2.0.23/main -I/private/tmp/pear/install/libsodium -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/libsodium/libsodium.c -fno-common -DPIC -o .libs/libsodium.o
    /private/tmp/pear/install/libsodium/libsodium.c:6:10: fatal error: ‘php.h’ file not found
    #include “php.h”
    ^~~~~~~
    1 error generated.
    make: *** [libsodium.lo] Error 1
    ERROR: `make’ failed
    jwb@MacBookAi7r ~ %

    Reply

Leave a Comment