brew

macos 上的包管理工具,类似linux的yum和apt

更换源地址

  • 中科大
1
2
3
4
5
6
7
cd $(brew --repo)
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git

cd $(brew --repo)/Library/Taps/homebrew/homebrew-core
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
  • 清华
1
2
3
4
5
6
7
cd $(brew --repo)
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/brew.git

cd $(brew --repo)/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew-core.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
  • 恢复缺省地址
    1
    2
    3
    4
    5
    cd $(brew --repo)
    git remote set-url origin https://github.com/Homebrew/brew.git

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

显示缓存目录

1
brew --cache

为应用程序单独设置语言

1
defaults write com.apple.iWork.Pages AppleLanguages '("zh-Hans")'

Macos 实时显示按键

1
brew cask install keycastr

MacOS 10.15 文件已损坏

1
xattr -r -d com.apple.quarantine

SIP

查看SIP状态

1
csrutil status

关闭SIP

重启 Command + R 进入恢复模式

1
csrutil disable

开启 SIP

1
csrutil enable

解决 无法打开应用,应该移到废纸篓

1
sudo spctl --master-disable