Mac中homebrew安装与配置

安装地址:https://brew.sh

也可以将下面这句话直接复制到终端执行:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • 常见问题:

    curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
    
    • 修改hosts文件:
      1.终端执行:sudo vi /etc/hosts
      2.添加:199.232.68.133  raw.githubusercontent.com
      3保存退出:Esc,:wq!
      
    • 修改homebrew镜像
      • 修改
      # brew 程序本身,Homebrew/Linuxbrew 相同
      git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
      
      # 以下针对 mac OS 系统上的 Homebrew
      git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
      git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
      git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
      git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git
      
      # 以下针对 Linux 系统上的 Linuxbrew
      git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git
      
      # 更换后测试工作是否正常
      brew update
      
      • 复原
      # brew 程序本身,Homebrew/Linuxbrew 相同
      git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
      
      # 以下针对 mac OS 系统上的 Homebrew
      git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
      git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
      git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://github.com/Homebrew/homebrew-cask-fonts.git
      git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://github.com/Homebrew/homebrew-cask-drivers.git
      
      # 以下针对 Linux 系统上的 Linuxbrew
      git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/linuxbrew-core.git
      
      # 更换后测试工作是否正常
      brew update
      
      

你可能感兴趣的:(Mac中homebrew安装与配置)