zoukankan      html  css  js  c++  java
  • Mac使用HomeBrew

    前言

    考虑许久终于决定入手mac耍耍,还是因为要找工作了,手上的win本大学入的,现在使用卡顿太多,另外就是mac作为程序员之友仰慕已久.决定在PDD入了.到手后发现mac真的跟win有很大差别.还是要慢慢适应啊,这里记录mac上的软件包管理 HomeBrew 的使用.

    变更记录

    # 19.9.3 起笔

    正文

    官网

    https://brew.sh/index_zh-cn

    安装Brew

    在终端执行

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

    第一次执行会要求你输入mac的密码

    下载速度过慢尝试FQ或修改源(推荐FQ)

    等待运行完成即可

    升级Git

    mac自带git但是有可能出现版本低的情况

    因为我们已经安装了Brew所以最好将软件包都交给 Brew 维护

    在终端输入

    brew install git

    等待安装完成即可

    安装Python

    同理, mac虽然自带了python但是版本是2.7

    我们可以安装一个python3

    brew install python

    会安装最近的python版本

    请注意,此时输入python3才可进入brew安装的版本

    输入python是系统的python2

    Brew常用命令

    https://docs.brew.sh/

    下方都以软件包 git 为例

    brew help  # 查看帮助
    brew install git  # 安装包,如是软件需要使用 brew cask install
    brew uninstall git  # 卸载包
    brew search git  # 搜索包
    brew list  # 查看安装的所有包
    brew update  # 更新brew,同时会将包列下(有更新的包后面会有✅)
    brew outdated  # 查看可更新的包
    brew upgrade git  # 更新包(不加包名代表更新全部)
    brew info git  # 查看包信息(安装时间/位置/大小等)
    brew home git  # 访问包官网
    brew cleanup git  # 清理本地的所有老版本包(不加包名代表清理全部)

    Brew切换国内源

    切换源到中科大,再也不担心网络问题啦

    # 替换brew.git:
     cd "$(brew --repo)"
    # 中科大:
     git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
    
    # 替换homebrew-core.git:
     cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    # 中科大:
     git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    
    # 替换homebrew-bottles:
    # 中科大:
     echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
     source ~/.bash_profile
    
    # 应用生效:
     brew update

    或者是清华源

    # 替换brew.git:
     cd "$(brew --repo)"
    # 清华大学:
     git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    
    # 替换homebrew-core.git:
     cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    # 清华大学:
     git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    
    # 替换homebrew-bottles:
    # 清华大学:
     echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
     source ~/.bash_profile
    
    # 应用生效:
     brew update

    Brew重置源

    将源更改为默认源

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

    # 修改
    homebrew-bottles:
    vim ~/.bash_profile
    去除 export HOMEBREW_BOTTLE_DOMAIN 行
    保存后刷新:
    source ~/.bash_profile

    # 应用生效:
     brew update
    
    
  • 相关阅读:
    django页面分类和继承
    django前端从数据库获取请求参数
    pycharm配置django工程
    django 应用各个py文件代码
    CF. 1428G2. Lucky Numbers(背包DP 二进制优化 贪心)
    HDU. 6566. The Hanged Man(树形背包DP DFS序 重链剖分)
    小米邀请赛 决赛. B. Rikka with Maximum Segment Sum(分治 决策单调性)
    区间树 学习笔记
    CF GYM. 102861M. Machine Gun(主席树)
    2016-2017 ACM-ICPC East Central North America Regional Contest (ECNA 2016) (B, D, G, H)
  • 原文地址:https://www.cnblogs.com/chnmig/p/11452845.html
Copyright © 2011-2022 走看看