- 简介: Homebrew是一个在MacOS或Linux上的软件包管理工具, Homebrew 会将软件包安装到独立目录,并将其文件软链接至
/usr/local
- Homebrew官网: https://brew.sh/
安装
在Terminal输入
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Homecrew会被利用
sudo
被安装至/home/linuxbrew/.linuxbrew
或~/.linuxbrew
, 安装后不会再使用sudo
. 使用/home/linuxbrew/.linuxbrew
会允许使用比在个人主目录下更多的二进制包.
安装时若报错: curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
浏览器登录:https://raw.githubusercontent.com/Homebrew/install/master/install
若无问题, 显示:
等待后重试安装语句
若无法显示网页,检查网络连接
将Homebrew加入PATH
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
对于zsh用户: 还需
test -r ~/.zsh_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.zsh_profile
echo "export PATH=$HOME/bin:/usr/local/bin:$PATH" >> ~/.zshrc
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.zshrc
source ~/.zshrc
测试brew install hello
截图
安装完毕
brew常用命令
-
brew –help
查看帮助 -
brew install *
安装 -
brew uninstall *
卸载 -
brew search *
查找 -
brew info *
显示详细信息 -
brew list
已安装列表 -
brew update
更新(所有目录内容, 对已经安装并有更新的内容用*
标明) -
brew update *
更新(指定内容) -
brew home
登陆https://brew.sh/ -
brew deps [options] [formula]
显示依赖 -
brew outdated
显示过时需要更新的内容 -
brew update
升级所有内容 -
brew pin [formula]
阻止特定内容升级 -
brew pin [formula]
恢复特定内容升级
更多命令&FAQ: Homebrew文档
网友评论