mac brew 使用
安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果卡住了,另行百度安装方法,代理问题
brew国内代理
内核core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
重置为官方地址
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core
http://mirrors.ustc.edu.cn/help/homebrew-core.git.html
brew git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
- 重置为官方
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
http://mirrors.ustc.edu.cn/help/brew.git.html
brew查询软件
有时候,你不知道你安装的软件的名字, 那么你需要先搜索下, 查到包的名字。
比如我要安装 golang
brew search golang
# /wge*/是个正则表达式, 需要包含在/中
brew search /wge*/
brew查询软件详情
brew info autojump
很多软件安装后,是在info里面说明怎么使用的,比如autojump
brew安装软件
一个命令就搞定了, 比如安装git
- 比如安装wget
# 建议单独安装git这样可以在更新某些软件的时候,git一直可用
brew install git
brew install wget
- 安装特定版本
brew install node@6
# 这里的node@6的详情可以通过下面的命令查询
brew info node@6
# 本地安装redis客户端,连接docker
brew install redis
升级软件
brew upgrade git
brew卸载软件
brew uninstall wget
软链软件环境变量
- 一般软件有软链的,不过不少是没有做软链的,需要用户配置
brew link gradle@2.14
brew unlink gradle@2.14
以服务方式启动
brew tap homebrew/services
# 不在开机时启动
brew services run mysql
# 在登录时启动
brew services start mysql
# 查看当前服务的列表
brew services list
# 查看当前用户登录启动的配置
cd ~/Library/LaunchAgents/
# 查看当前的开机启动配置
cd /Library/LaunchDaemons/
详细文档 https://github.com/Homebrew/homebrew-services
其他brew命令
| ---------------------------------------------------- |
| | 命令名称 | 用途 | |
| | --------------- | ------------------------------ | |
| | brew list | 列出已安装的软件 | |
| | brew outdated | 列出那些软件需要更新 | |
| | brew update | 更新brew | |
| | brew home | 用浏览器打开brew的官方网站 | |
| | brew deps | 显示包依赖 | |
| | brew list redis | 查看redis的安装文件 | |
| | brew cat redis | 查看redis的 brew 安装脚本 | |
| | brew cleanup | 删除所有软件升级后的遗留旧版本 | |

浙公网安备 33010602011771号