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查看信息即可

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。