安装
一定可以成功的安装和卸载脚本:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" # 安装脚本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)" # 卸载脚本常用命令
brew update # 更新 Homebrew
brew upgrade # 更新所有安装过的软件笔记
brew prefix可以查看homebrew安装路径- 路径
/opt/homebrew在 Mac 根目录,按⌘ + ⇧ + .显示隐藏文件后可以看见
将 macOS 的自带 Git 换到 homebrew 安装的 Git
- 用
which git查看 git 安装路径 - 用
git --version查看 git 版本 - 输入以下命令修改 git 默认路径
echo export PATH='/opt/homebrew/Cellar/git/2.48.1/bin:$PATH' >> ~/.bash_profile - 输入
source .bash_profile刷新坏境变量,用最开始提到的命令查看是否成功 - 用
vim ./.bash_profile打开bash_profile文件,输入i进入编辑模式,这时可以编辑内容,编辑好后按esc退出编辑状态,再按:wq退出。 - 我目前的坏境变量如下所示:
export PATH=/usr/local/bin:$PATH export PATH=/opt/homebrew/bin:$PATH export PATH=/opt/homebrew/Cellar/git/2.48.1/bin:$PATH - 参考资料:
源
参考资料
- Homebrew国内如何自动安装(国内地址)(Mac OS) - 知乎
- macOS 常见错误说明
- HomebrewCN: Homebrew 国内安装脚本,快速部署 brew ,国内镜像
- Homebrew 主页 — The Missing Package Manager for macOS (or Linux)
- Homebrew Documentation Homebrew 官方文档,很多内容可以从这里找到,以下摘出来的几个链接也是从这里获得。2024-10-05 21:03:19
- Homebrew Formulae
- Homebrew Blog
- Installation — Homebrew Documentation
- How do I update my local packages?
- Homebrew terminology
- Homebrew 中文网
- Mac下的包管理神器,Homebrew最全入门指南_homebrew core-CSDN博客