# brew

# brew

#### 目录结构

```sh
# Homebrew 
/usr/local/Homebrew
# 通过 brew 安装的软件
/usr/local/Cellar
```



#### 常用命令

```sh
# 
brew --repo # ouput /usr/local/Homebrew
# 查看信息
brew info $repo
# 安装
brew install $
# 卸载
brew uninsatlll $
```



#### 切换到国内源

```bash
# 替换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
```



#### 切换到官方源

```bash
# 重置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

```sh
binutils  # 包含 readelf objdump
trash     # safe rm, rm -> trash
tree
zsh
tig      # git 命令行交互工具
vim
ranger   # 命令行 文件浏览器
git
expect
```



#### Q&A


##### 安装特定版本

##### 移除 警告

