MacOS 安装pear

1、下载Pear

curl -O https://pear.php.net/go-pear.phar

2、安装Pear

sudo php -d detect_unicode=0 go-pear.phar

安装过程需要进行简单的配置,如下

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : /usr
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/bin
 5. PHP code directory ($php_dir)                 : /usr/share/pear
 6. Documentation directory                       : /usr/docs
 7. Data directory                                : /usr/data
 8. User-modifiable configuration files directory : /usr/cfg
 9. Public Web Files directory                    : /usr/www
10. System manual pages directory                 : /usr/man
11. Tests directory                               : /usr/tests
12. Name of configuration file                    : /private/etc/pear.conf

1-12, 'all' or Enter to continue: 1

输入 1,将安装根目录修改为 /usr/local/pear;
输入 4,将命令安装到 /usr/local/bin 目录;
其它选项默认即可,一路回车。

检测是否安装成功

输入 pear version

pear version

如果现实如下信息,则安装成功

PEAR Version: 1.10.5
PHP Version: 7.1.7
Zend Engine Version: 3.1.0

如果还是显示

command not found: pear

则可能是pear的环境变量没有配置

打开bash.profile

open ~/.bash_profile

添加pear的路径

export PATH="/usr/bin/pear:$PATH"

保存配置

source ~/.bash_profile

再次执行pear version查看信息即可

你可能感兴趣的:(MacOS 安装pear)