修改用户名
sudo hostname macbookpro
sudo scutil --set HostName macbookpro
sudo scutil --set LocalHostName macbookpro
MacPort
修改更新源
- 进入你安装macports的资料夹,比如官方的dmg装出来的是
/opt/local/etc/macports
- 编辑sources.conf在最底下加入,注释掉其他的源
rsync://mirrors.tuna.tsinghua.edu.cn/macports/release/tarballs/ports.tar [default]
- 还需要在macports.conf中,修改rsync_server为
mirrors.tuna.tsinghua.edu.cn
- 还需要在macports.conf中,修改rsync_dir为
macports/release/tarballs/base.tar
HomeBrew
安装
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
修改更新源
Homebrew的更新源由三部分组成:
- 本体(brew.git)
- 核心(homebrew-core.git)
- 二进制预编译包(homebrew-bottles)
- 需要对这个三个部分,分别进行设置。
清华大学
# 替换brew.git:
cd "$(brew --repo)"
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.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 应用生效:
brew update
中国科大
# 替换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
# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 应用生效:
brew update
取消Brew更新
export HOMEBREW_NO_AUTO_UPDATE=true