brew

brew

目录结构

1
2
3
4
# Homebrew 
/usr/local/Homebrew
# 通过 brew 安装的软件
/usr/local/Cellar

常用命令

1
2
3
4
5
6
7
8
# 
brew --repo # ouput /usr/local/Homebrew
# 查看信息
brew info $repo
# 安装
brew install $
# 卸载
brew uninsatlll $

切换到国内源

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 替换brew.git:
$ cd "$(brew --repo)"
# 中国科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华大学:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替换homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中国科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清华大学:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替换homebrew-bottles:
# 中国科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 清华大学:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

# 应用生效:
$ brew update

切换到官方源

1
2
3
4
5
6
7
# 重置brew.git:
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git

# 重置homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git

常用 tool

1
2
3
4
5
6
7
8
9
binutils  # 包含 readelf objdump
trash     # safe rm, rm -> trash
tree
zsh
tig      # git 命令行交互工具
vim
ranger   # 命令行 文件浏览器
git
expect

Q&A

安装特定版本
移除 警告