首页 >运维 >Mac OS > 正文

一招教你怎么使用mac 安装配置 homebrew(代码分享)

转载2021-09-02 13:58:080786

之前的文章《浅析JS中base64和图片互相转换(附代码)》中,给大家了解了JS中base64和图片互相转换。下面本篇文章给大家介绍怎么使用mac安装配置homebrew,我们一起看看怎么做。

最近换电脑了,发现homebrew安装不上了,我感觉是网络问题,连了个vpn,发现还是不行,哈哈,是姿势不对

安装

运行下面自动脚本(已经全部替换为国内地址):

(Mac)常规安装脚本(推荐完全体几分钟安装完成)

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

(Mac)精简版几秒钟安装完成

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

(Mac)卸载脚本

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

(Linux)安装脚本:

rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh

(Linux)卸载脚本:

rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh

安装问题

如果发现有各种安装不上的运行:

sudo rm -rf /usr/local/Homebrew

提示系统太旧的 (Failed to install Homebrew Portable Ruby (and your system version is too old)!) 运行:

HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles-portable-ruby

rm -rf /Users/$(whoami)/Library/Caches/Homebrew/

brew update

切换镜像源

阿里云homebrew

配置方法:[https://developer.aliyun.com/mirror/homebrew]。

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

腾讯云homebrew

配置方法:Homebrew镜像使用帮助

[https://mirrors.cloud.tencent.com/help/homebrew.html]。

cd "$(brew --repo)"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/homebrew-core.git

brew update

配置方法:Homebrew-bottles镜像使用帮助

[https://mirrors.cloud.tencent.com/help/homebrew-bottles.html]。

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

中科大homebrew

配置方法:Homebrew源使用帮助[http://mirrors.ustc.edu.cn/help/brew.git.html]。

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

配置方法:Homebrew Core源使用帮助[http://mirrors.ustc.edu.cn/help/homebrew-core.git.html]。

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

配置方法:Homebrew Bottles源使用帮助[http://mirrors.ustc.edu.cn/help/homebrew-bottles.html]。

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

推荐学习:MacOS教程

以上就是一招教你怎么使用mac 安装配置 homebrew(代码分享)的详细内容,更多请关注php中文网其它相关文章!

php中文网最新课程二维码

声明:本文转载于:禅境花园,如有侵犯,请联系admin@php.cn删除

  • 相关标签:mac
  • 相关文章

    相关视频


    网友评论

    文明上网理性发言,请遵守 新闻评论服务协议

    我要评论
  • 专题推荐

    作者信息
    推荐视频教程
  • 大型公益实战天龙八部之开发Mini版MVC框架仿糗事百科网站大型公益实战天龙八部之开发Mini版MVC框架仿糗事百科网站
  • Mac PHP开发工具与环境搭建Mac PHP开发工具与环境搭建
  • 视频教程分类