mac安装brew
配置VPN的终端代理:
vi ~/.zshrc
# proxy list alias proxy='export https_proxy=http://127.0.0.1:23457;export http_proxy=http://127.0.0.1:23457;export all_proxy=socks5://127.0.0.1:23456' alias unproxy='unset http_proxy;unset https_proxy;unset all_proxy' alias proxy_test='curl -v google.com'
source ~/.zshrc
启用代理:
proxy
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew 常用命令
查看 brew 的安装位置
which brew
查找软件
brew search jadx
安装软件
brew install jadx
安装指定版本:
brew install php@7.2
mac安装PHP成功案例:
==> php@7.2
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.2/
php@7.2 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have php@7.2 first in your PATH, run:
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.zshrc
For compilers to find php@7.2 you may need to set:
export LDFLAGS="-L/usr/local/opt/php@7.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.2/include"
To start shivammathur/php/php@7.2 now and restart at login:
brew services start shivammathur/php/php@7.2
Or, if you don't want/need a background service you can just run:
/usr/local/opt/php@7.2/sbin/php-fpm --nodaemonize
vi ~/.zshrc
export PATH="/usr/local/opt/php@7.2/bin:$PATH" export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
source ~/.zshrc
卸载软件
brew uninstall jadx
# 强制卸载
brew uninstall --force jadx
重装软件
brew reinstall jadx
安装软件列表
# 所有列表
brew list
# jadx 列表
brew list jadx
查看帮助
brew --help
更新软件
brew update
brew upgrade jadx # 更新 jadx
显示软件信息
brew info jadx
使用浏览器打开 brew 的官网
brew home
查看依赖树
# 查看 jadx 的依赖树
brew deps --tree jadx
# 查看所有已安装软件的依赖树
brew deps --installed --tree
# 浏览器打开所有已安装软件以图形方式显示的依赖树
brew deps --installed --graph
查看已安装软件已安装版本与最新版本
brew outdated
清理旧版本软件
# 清理所有旧版本的软件
brew cleanup
# 清理 jadx 的旧版本
brew cleanup jadx
# 查看可清理的旧版本软件
brew cleanup -n
查看下载缓存路径
brew --cache
查看安装目录
使用 brew 安装的软件一般放到安装目录下的 Cellar 目录中。
其中 Intel Mac 是 /usr/localCellar,ARM Mac 则是 /opt/homebrew/Cellar。
brew --prefix
锁定不想更新的软件
brew pin jadx
取消锁定
brew unpin jadx
自检
如果自检发现问题, brew 会给出解决方案。
brew doctor
常见问题
Failed to connect to http://raw.githubusercontent.com port 443: Connection refused.
可以使用国内源进行安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
国内源卸载脚本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
