Homebrew安装

2022.4.12更新

/bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

 

-----------------------------------------------------------

最近遇到报错 zsh: command not found: tree

按照网上教程:

1 找到 .bash_profile 文件
新加 export PATH=/bin:/usr/bin:/usr/local/bin:$PATH

2、source .bash_profile
并在.zshrc中添加一行 source ~/.bash_profile

3 执行以一下 $ source .zshrc

但是没起作用。

于是使用 homebrew 安装 tree 命令行:

$ brew install tree

linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案,Red hat有yum,Ubuntu有apt-get。神马,你用mac os,不好意Mac os木有类似的东东。几经折腾总算找到了第三方支持:Homebrew,Homebrew简称brew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件,可以说Homebrew就是mac下的apt-get、yum神器

安装指令:

/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

最后看到==> Installation successful!就说明安装成功了。

然后更新下:

brew update

再设置前三者镜像(brewhomebrew/core是必备项目,homebrew/caskhomebrew/bottles按需设置):

清华大学源

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

brew update

最后设置bottles镜像:镜像以清华大学为例。

macOS Catalina(10.15.x) 版开始,Mac使用zsh作为默认Shell,对应文件是.zprofile,所以命令为:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile

详见 mac下镜像飞速安装Homebrew教程 - 知乎 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值