美文网首页
2020-04-15

2020-04-15

作者: zhhehj | 来源:发表于2020-04-15 11:20 被阅读0次

    最近换了Mac,安装Homebrew很慢(以前好像并没有这么慢),Downloading and installing Homebrew...只有10KB/S.解决方法主要思路是把git切换为清华镜像,话不多说,直接看步骤吧.

    image

    1.用safari打开“https://raw.githubusercontent.com/Homebrew/install/master/install.sh”,把里面的文本复制下来,在桌面创建文本文件“brew_install”,粘贴.

    2.搜索:

    BREW_REPO="https://github.com/Homebrew/brew"
    
    

    替换成:

    BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
    
    

    保存.

    3.打开terminal,运行命令:/bin/bash + 刚才的brew_install文件,比如:

    /bin/bash /Users/admin/Desktop/brew_install
    
    
    image

    4.进入下面的 Taps 目录,clone homebrew-core

    cd /usr/local/Homebrew/Library/Taps/homebrew (如果没有homebrew,新建homebrew文件夹)
    
    git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    
    

    5.把homebrew repo切换为清华镜像

    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
    
    

    PS:如果有报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused,可以通过这个命令解决:sudo gem install redis

    备注:其中我在安装的homebrew-core的时候总是不成功
    参考了下边的链接
    https://blog.csdn.net/zhukovlxx/article/details/104729966/

    使用git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
    来下载homebrew-core
    (转载自小八子的开发之路,用于记录)

    相关文章

      网友评论

          本文标题:2020-04-15

          本文链接:https://www.haomeiwen.com/subject/raicuhtx.html