Mac brew教程

  • 一、安装brew

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

    二、查看brew版本

    brew -v
    

    在这里插入图片描述

    brew -v

    三、搜索软件

    命令格式:brew search 软件名 eg:

    brew search nginx
    

    四、安装软件

    命令格式:brew install 软件名 eg:

    brew install nginx
    

    五、卸载软件

    命令格式:brew uninstall 软件名 eg:

    brew uninstall nginx
    

    六、查看安装的软件列表

    brew list
    

    七、更新 brew

    brew update
    

    八、显示软件信息

    brew info
    

    九、显示包依赖

    brew deps
    

    十、确认 brew 是否在正常工作

    brew doctor
    

    十一、配置brew源

    1、替换成国内中科源:

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

    homebrew-core

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

    homebrew-cask

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

    如果你的Mac使用的是zsh终端,使用如下命令:

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

    如果你的Mac使用的是bash终端,使用如下命令:

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

    更新

    brew update
    

    2、替换成国内阿里源

    cd "$(brew --repo)" && git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
    

    homebrew-core

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
    

    homebrew-cask

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git
    

    如果你的Mac使用的是zsh终端,使用如下命令:

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc &&  source ~/.zshrc
    

    如果你的Mac使用的是bash终端,使用如下命令:

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile  && source ~/.bash_profile
    

    更新

    brew update
    

    十二、还原brew的源

    cd "$(brew --repo)" && git remote set-url origin https://github.com/Homebrew/brew.git
    
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://github.com/Homebrew/homebrew-core.git
    

    如果你的Mac使用的是zsh终端,使用如下命令:

    vim ~/.zshrc
    # 删除 HOMEBREW_BOTTLE_DOMAIN 配置
    source ~/.zshrc
    

    如果你的Mac使用的是bash终端,使用如下命令:

    vim ~/.bash_profile
    # 删除 HOMEBREW_BOTTLE_DOMAIN 配置
    source ~/.bash_profile
    

    更新

    brew update
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

可口可乐Vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值