1. 升級PostgreSQL
最近PostgreSQL更新到了10,于是將原來的9.6進行升級。
brew upgrade postgresql
2. 升級Python3
電腦中的Python版本為3.6.1,于是也嘗試升級到最新的3.6.3。
brew upgrade python3
3. 在命令行中使用python3
升級Python后,原先的在命令行中使用Python3.6的命令python3
失效,需要修改配置。
3.1. 打開.bash_profile文件
終端輸入:
open ~/.bash_profile
3.2. 編輯bash_profile文件內容
PATH="/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
#添加別名
Alias python3="/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin/python3.6"
3.3. 重新讀取.bash_profile文件
終端輸入:
source .bash_profile
4. 替換brew源
官方源下載速度實在太慢,可以替換成中科大或清華的鏡像:
4.1. 中科大鏡像
替換brew.git,終端輸入:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/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
4.2. 清華鏡像:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
替換Homebrew-bottles:
open ~/.bash_profile
加入:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
保存
source .bash_profile
4.3. 還原官方源:
重置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