• 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

  • 相关阅读:
    SSH 转发学习【转】
    JAVA 垃圾笔记一溜堆
    PHP CURL 伪造IP和来路
    PHP CURL 抓取失败 自己调试
    Tomcat 基本配置
    windows 64位 下 安装 tomcat
    UBUNTU下MONGODB出现PHP Fatal error: Uncaught exception 'MongoConnectionException' with message 和 Authentication failed on database 'admin' with username
    汽车牌牌知识
    一个用pyton写的监控服务端进程的软件hcm
    Python3.x和Python2.x的区别
  • 原文地址:https://www.cnblogs.com/whosmeya/p/13114438.html
Copyright © 2020-2023  润新知