zoukankan      html  css  js  c++  java
  • Mac包管理工具brew的安装、使用及换源

    The Missing Package Manager for macOS (or Linux). 官网

    安装

    $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    ==> This script will install:
    /usr/local/bin/brew
    /usr/local/share/doc/homebrew
    /usr/local/share/man/man1/brew.1
    /usr/local/share/zsh/site-functions/_brew
    /usr/local/etc/bash_completion.d/brew
    /usr/local/Homebrew
    ...
    

    如果连接被拒绝,查看解决方案 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

    查看

    $ brew -v
    Homebrew 2.2.17
    Homebrew/homebrew-core (git revision 3dad3; last commit 2020-05-19)
    

    使用

    # 安装管理
    $ brew --help
    Example usage:
      brew search [TEXT|/REGEX/]
      brew info [FORMULA...]
      brew install FORMULA...
      brew update
      brew upgrade [FORMULA...]
      brew uninstall FORMULA...
      brew list [FORMULA...]
    ...
    
    # 服务管理
    $ brew services --help
    ...
    

    使用 brew 安装的软件默认路径:/usr/local/Cellar

    换源

    换清华源

    git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    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
    

    还原官方

    git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
    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
    

    查看源配置

    $ cd "$(brew --repo)"
    $ git remote get-url origin
    https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    

    whosmeya.com

  • 相关阅读:
    pipeline+sonar
    ThinkPHP 3.2.3 使用 PHPExcel 处理 Excel 表格
    mac下finder子目录直接打开终端
    golang之交叉编译设置
    cocos2dx 3.0 编译工程
    2dx 3.0环境配置(mac)
    golang调用动态库
    qt下用启动图
    qt在动态库里面加载widget的例子
    qt笔记
  • 原文地址:https://www.cnblogs.com/whosmeya/p/13114438.html
Copyright © 2011-2022 走看看