Homebrew

homebrew

更多more

Homebrew是一款包管理工具,主要由④ 部分组成:brew、homebrew-core、homebrew-cask、homebrew-bottles

名称 说明
brew Homebrew 源代码仓库
homebrew-core Homebrew 核心源
homebrew-cask 提供 macOS 应用和大型二进制文件的安装
homebrew-bottles 预编译二进制软件包

安装homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

或者

脚本内置中科大的镜像源

/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
  • 如果命令卡在下面信息

    ==> Tapping homebrew/core
    Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
    

    或者查看/usr/local/Homebrew/Library/Taps/homebrew下面没有homebrew-core文件夹, 手动克隆

    cd "$(brew --repo)/Library/Taps/"
    mkdir homebrew && cd homebrew
    git clone git://mirrors.ustc.edu.cn/homebrew-core.git
    
  • 安装cask 同样也有安装失败或者卡住的问题,解决方法也是一样:

    cd "$(brew --repo)/Library/Taps/"
    cd homebrew
    git clone https://mirrors.ustc.edu.cn/homebrew-cask.git
    
  • 成功执行之后继续执行安装命令。

    最后看到==> Installation successful!就说明安装成功了。

    最最后更新下:

    brew update
    

查看当前源

  • brew源

    cd "$(brew --repo)" && git remote -v
    
  • homebrew-core

    cd "$(brew --repo homebrew/core)" && git remote -v
    
  • home-bottles

    查看Mac终端shell类型是bash还是zsh

    echo $SHELL
    >  /bin/bash  # bash
    >  /bin/zsh   # zsh
    

    切换shell类型

    • 切换到bash:chsh -s /bin/bash
    • 切换到zsh:chsh -s /bin/zsh
  • home-cash

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote -v
    

换源

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
brew update

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile

posted @ 2021-07-30 11:43  shine_lovely  阅读(113)  评论(0编辑  收藏  举报