• 当前位置: 首 页 > 教育百科 > 其他 > 正文

    运维管理:Mac利器Brew镜像源以及使用

    :2022年05月02日
    六月暴雪飞梨花

    Brew 镜像源以及使用Homebrew应用在MacOS。

    Brew 镜像源以及使用
    Homebrew应用在MacOS。
    1.1 查看当前镜像源的信息
    # 查看brew镜像源
    git -C "$(brew --repo)" remote -v
    # 查看homebrew-core镜像源
    git -C "$(brew --repo homebrew/core)" remote -v
    # 查看homebrew-cask镜像源(需要安装后才能查看)
    git -C "$(brew --repo homebrew/cask)" remote -v

    执行 brew 命令安装应用的时候,跟以下 3 个仓库地址有关。
        brew.git (源代码仓库)
        homebrew-core.git (核心软件仓库)
        homebrew-bottles (预编译二进制软件包)
    1.2 修改为中科大镜像源
    # 修改brew镜像源
    git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
    # 修改homebrew-core镜像源
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    # 修改homebrew-cask镜像源(需要安装后才能修改)
    git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
    # 更新
    brew update

    或者
    # 进到目录,更改镜像源
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
    # 进到目录,更改镜像源
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    # 修改.bash_profile配置信息,并使文件生效
    source ~/.base_profile
    # 测试更新
    brew update

    参考地址:https://lug.ustc.edu.cn/wiki/mirrors/help/homebrew-bottles
    1.3 修改为阿里云镜像源
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
     
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
    # 别忘记更新配置文件,并生效配置文件
    source ~/.base_profile
    # 测试更新
    brew update

    1.4 清华大学镜像源
    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
    # 别忘记更新配置文件,并生效配置文件
    source ~/.base_profile
    # 测试更新
    brew update

    参考地址:https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
    1.5恢复默认设置镜像源
    # 恢复brew镜像源
    git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
    # 恢复homebrew-core镜像源
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
    # 恢复homebrew-cask镜像源(需要安装后才能修改)
    git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
    brew update

    1.6 更改配置文件
    ### aliyun io
    # export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
    ### 中科大 io
    # export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
    ### 清华大学 io
    # export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

    1.7 brew 常用命令
    命令    说明    
    brew –help    #查看brew的帮助    
    brew install git    #安装git软件    
    brew uninstall git    #卸载git软件    
    brew search git    #搜索git软件    
    brew list    #显示已经安装软件列表    
    brew update    #更新软件,把所有的Formula目录更新,并且会对本机已经安装并有更新的软件用*标明。    
    brew upgrade git    #更新某具体软件    
    brew [info|home] [FORMULA…]    #查看软件信息    
    brew cleanup git    #单个软件删除,和upgrade一样    
    brew cleanup    #删除所有    
    brew outdated    #查看那些已安装的程序需要更新    
    brew home *    #用浏览器打开    
    brew info *    #显示软件内容信息    
    brew deps *    #显示包依赖    
    brew config    #查看brew配置   
    ————————————————
    版权声明:本文为CSDN博主「六月暴雪飞梨花」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/L_Lycos/article/details/113680436

    [编辑:王振袢 &发表于江苏]
    [我要纠错]

    来源:本文内容搜集或转自各大网络平台,并已注明来源、出处,如果转载侵犯您的版权或非授权发布,请联系小编,我们会及时审核处理。
    声明:江苏教育黄页对文中观点保持中立,对所包含内容的准确性、可靠性或者完整性不提供任何明示或暗示的保证,不对文章观点负责,仅作分享之用,文章版权及插图属于原作者。

    关键词: Brew 镜像 以及 使用 Homebrew
    有价值
    0
    无价值
    0
    猜您喜欢
    最热文章

    暂不支持手机端,请登录电脑端访问

    正在加载验证码......

    请先完成验证