最近折腾Mac,总结下填过的坑。
Homebrew
入手Mac后,安装的Macport,使用了将近3年的时间。随着最近折腾一些软件,感觉超级不爽,尤其更新ffmpeg的时候,风扇能转出天际。果断更换Homebrew。
Homebrew 安装
安装
1
|
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
检查
brew -v
替换更新源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# 替换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
# 阿里:
$ git remote set-url origin https://mirrors.aliyun.com/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
# 阿里:
$ git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 替换homebrew-bottles,科大清华阿里可选:
# 中国科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# 清华大学:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# 阿里:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# 应用生效:
$ brew update
# 重置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
# 重置homebrew-bottles:
$ vim ~/.zshrc # 删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
$ source ~/.zshrc
|
Homebrew 常用命令
1
2
3
4
5
6
7
8
|
brew update #更新Homebrew
brew doctor #诊断
brew search <packageName> #搜索程序
brew install <packageName> #安装程序
brew uninstall <packageName> #卸载程序
brew list #列出Homebrew安装的程序
brew upgrade <packageName> #更新所有程序或指定更新
brew cleanup <packageName> #删除旧版本或者指定删除
|