clrss
V2EX  ›  macOS

export HOMEBREW_INSTALL_FROM_API=1

  •  
  •   clrss · Aug 11, 2022 · 1793 views
    This topic created in 1396 days ago, the information mentioned may be changed or developed.
    % man brew
    ...
           HOMEBREW_INSTALL_FROM_API
                  If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew´s
                  API instead of needing (large, slow) local checkouts of these repositories.
    
                  Note: Setting HOMEBREW_INSTALL_FROM_API is not compatible with Homebrew´s developer mode so
                  will error (as Homebrew development needs a full clone).
    

    设置这个环境变量以后可以 brew untap homebrew/core brew untap homebrew/cask. 省几百 MB 空间. 先不说缺不缺这些空间, 把那十多年的 formula 历史放普通用户硬盘上本来就不科学.

    副作用未知.

    4 replies    2023-02-14 10:51:09 +08:00
    leon0318
        1
    leon0318  
       Aug 12, 2022 via iPhone
    副作用未知……
    clrss
        2
    clrss  
    OP
       Aug 12, 2022
    感觉不好用, 比如 cleanup 会卡死.

    早年是 shallow clone, 没那么占空间, 后来 GitHub 说 CPU 占用太大不要 shallow.

    那我们换个源吧, 他们没说不能 shallow.
    export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git
    https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

    需要改下 brew 代码, 我就不教了, 免得上面两镜像管理员来打我.
    julyclyde
        3
    julyclyde  
       Aug 15, 2022
    @clrss 为什么 shallow 会占 github 的 cpu 呢?
    按说 git 是各版本独立保存啊,只取最后版本其实不费什么事吧
    除非他们把最后一版和旧的一起 pack 了??
    clrss
        4
    clrss  
    OP
       Feb 14, 2023
    /t/915929 HOMEBREW_INSTALL_FROM_API 已经是默认设置了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5753 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 06:30 · PVG 14:30 · LAX 23:30 · JFK 02:30
    ♥ Do have faith in what you're doing.