zoukankan      html  css  js  c++  java
  • Mac下使用国内镜像安装Homebrew

    根据官网上的方法,在终端输入:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    结果还是被卡在下载阶段,怎么办呢?于是上网搜索到了“Homebrew 的安装方法(官方的方法老是安装失败) 第三方”这篇文章。

    依文中所述,进行安装。由于官方弃用了旧的homebrew仓库,将homebrew程序与软件包拆分成了两个仓库。与文中描述不符,也未能成功安装。于是稍作修改,记录于此。

    国内的镜像

    新增brew.git与homebrew-core.git镜像

    由于官方弃用了旧的homebrew仓库,将homebrew程序与软件包拆分成了两个仓库。为保证用户正常升级,旧镜像将暂时保留一段时间,择期删除。

    仓库对应关系:

    github.com/Homebrew/brew -> mirrors.ustc.edu.cn/brew.git
    github.com/Homebrew/homebrew-core -> mirrors.ustc.edu.cn/homebrew-core.git
    github.com/Homebrew/homebrew(弃用) -> mirrors.ustc.edu.cn/homebrew.git

    引自:新增brew.git与homebrew-core.git镜像

    安装

    获取install文件并编辑

    cd ~
    curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
    

    编辑brew_install文件

    #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
    # This script installs to /usr/local only. To install elsewhere you can just
    # untar https://github.com/Homebrew/brew/tarball/master anywhere you like or
    # change the value of HOMEBREW_PREFIX.
    HOMEBREW_PREFIX = "/usr/local".freeze
    HOMEBREW_REPOSITORY = "/usr/local/Homebrew".freeze
    HOMEBREW_CACHE = "#{ENV["HOME"]}/Library/Caches/Homebrew".freeze
    HOMEBREW_OLD_CACHE = "/Library/Caches/Homebrew".freeze
    #BREW_REPO = "https://github.com/Homebrew/brew".freeze
    BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze
    #CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze
    CORE_TAP_REPO = "git://mirrors.ustc.edu.cn/homebrew-core.git".freeze
    

    注释掉BREW_REPO = "https://github.com/Homebrew/brew".freezeCORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze

    修改为BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freezeCORE_TAP_REPO = "git://mirrors.ustc.edu.cn/homebrew-core.git".freeze

    安装

    /usr/bin/ruby ~/brew_install 
    

    运行修改了的brew_install文件。

    替换homebrew源

    替换homebrew默认源

    cd "$(brew --repo)"
    git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
    

    替换homebrew-core源

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

    brew更新

    brew update
    

    设置 bintray镜像

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



    作者:采姑娘的小魔钴
    链接:https://www.jianshu.com/p/6523d3eee50d

  • 相关阅读:
    Sqlserver 迁移数据库批量迁移作业(Job)
    在VS2010开发的MVC3 应用程序中设定默认的浏览器
    创建继承自System.Web.UI.WebControls.WebControl基类的控件类
    遍历页面控件
    @fontface
    加密配置节点
    视图状态的程序分块
    BlogEngine.NET 1.5的BlogProvider、DbBlogProvider
    避免target特性
    SCOPE_IDENTITY、IDENT_CURRENT 、@@IDENTITY
  • 原文地址:https://www.cnblogs.com/alter888/p/9471912.html
Copyright © 2011-2022 走看看