macos brew install 怎么查看安装时选择了哪些选项

比如安装PHP,
我们会先通过命令brew options php71查看有哪些选项是可以选择的。

--with-cgi
        Enable building of the CGI executable (implies --without-fpm)
--with-debug
        Compile with debugging symbols
--with-embed
        Compile with embed support (built as a static library)
--with-enchant
        Build with enchant support
--with-gmp
        Build with gmp support
--with-homebrew-curl
        Include Curl support via Homebrew
--with-homebrew-libressl
        Include LibreSSL instead of OpenSSL via Homebrew
--with-homebrew-libxml2
        Include Libxml2 support via Homebrew
--with-homebrew-libxslt
        Include LibXSLT support via Homebrew
--with-httpd
        Enable building of shared Apache Handler module
--with-imap
        Include IMAP extension
--with-libmysql
        Include (old-style) libmysql support instead of mysqlnd
--with-mssql
        Include MSSQL-DB support
--with-pdo-oci
        Include Oracle databases (requries ORACLE_HOME be set)
--with-pear
        Build with PEAR
--with-phpdbg
        Enable building of the phpdbg SAPI executable
--with-postgresql
        Build with postgresql support
--with-thread-safety
        Build with thread safety
--with-webp
        Build with webp support
--without-bz2
        Build without bz2 support
--without-fpm
        Disable building of the fpm SAPI executable
--without-ldap
        Build without LDAP support
--without-legacy-mysql
        Do not include the deprecated mysql_ functions
--without-mysql
        Remove MySQL/MariaDB support
--without-pcntl
        Build without Process Control support
--without-unixodbc
        Build without unixODBC support
--HEAD
        Install HEAD version

比如我选择这样子安装:

brew install php71 --with-homebrew-curl --with-homebrew-libressl

然后过了一段时间,我发现还需要加一个参数--with-httpd,能不能不卸载直接加上这个选项?

如果必须卸载掉重新安装,
那我要怎么查看第一次安装时选择了哪些选项?还是只能凭记忆?

阅读 4.9k
1 个回答

brew 是通过ruby脚本来完成安装管理的.

通过

brew edit php71

可以打开编辑器编辑相应的的安装脚本

通过查看/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Formula/php71.rb 及其相关的依赖项目/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Abstract/abstract-php.rb可以看到, 以php71为例, 脚本并不没有把相关的依赖项目--with-XXX保存到磁盘(方法 _install及 install_args).

所以不严密的结论是,默认情况下没有办法知道上次安装都有哪些选项.

可能通过

brew info php71

来查看依赖关系和可能选项.

因为一些选项是包的编译选项, 所以更改选项估计只能通过重装才行.

安装或系统改动保留脚本是个好习惯,记忆是不可靠的.
可以用CTRL>+R最近的输入历史, 或用history查看以往操作.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题