微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Mac brew 配置&操作


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

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

3.终端输入命令:
echo $SHELL 看输出结果是/bin/zsh还是/bin/bash
/bin/zsh替换homebrew-bottles:
echo 'export HOMEBREW_BottLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

/bin/bash替换homebrew-bottles:
echo 'export HOMEBREW_BottLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

4、恢复homebrew国内镜像源配置
①、重置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
将~/.bash_profile或~/.zshrc
HOMEBREW_BottLE_DOMAIN 进行注释


查找软件 brew search software
安装软件 brew install PHP
安装指定版本 brew install PHP@7.4

卸载 brew uninstall PHP

启动PHP@7.4 brew services start PHP@7.4

vim ~/.zshrc
环境变量写入 export PATH="$HOME/.composer/vendor/bin:$PATH" // $HOME代表 ~

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐