跳到主要内容

mac Homebrew 安装 设置国内源 和 git安装 CocoaPods

管

管理员

其他

2021年08月07日 2,385 次阅读
本页目录

苹果电脑 极速安装脚本(精简版 几秒钟安装完成):

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

切换中科大国内源:(两行两行的复制....)

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

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

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

# 应用生效
brew update
# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

git安装:

brew install git

使用 vi 打开 .gitconfig 文件:

vi ~/.gitconfig

写入下列配置(建议在最末写入):
 

[http]
    proxy = socks5://127.0.0.1:10808
    proxy = http://127.0.0.1:10809
[https]
    proxy = socks5://127.0.0.1:10808
    proxy = https://127.0.0.1:10809


 

修改后重启 git ,使配置生效:

git config -l --global

查看当前代理:

git config -l

安装CocoaPods:

  • 查找默认源

    gem sources
    
  • 移除默认源 添加新源

  • # 添加镜像源并移除默认源. 或者 https://mirrors.tuna.tsinghua.edu.cn/rubygems/
    gem sources --add https://mirrors.aliyun.com/rubygems/ --remove https://rubygems.org/
    # 列出已有源
    gem sources -l
    # 应该只有镜像源一个

安装cocoapods:
 

sudo gem install -n /usr/local/bin cocoapods

pod setup

Homebrew国内如何自动安装(国内地址) - 知乎 (zhihu.com)
Homebrew切换为国内镜像源 - zetaiota - 博客园 (cnblogs.com)

Related

相关文章

同分类文章 →
2026年03月09日 其他

openclaw安装,扩展

set NODE_LLAMA_CPP_SKIP_DOWNLOAD=true export NODE_LLAMA_CPP_SKIP_DOWNLOAD=true npm install -g openclaw@latest openclaw onboard --install-daemon

2026年02月25日 其他

为什么金融级系统严禁直存“北京时间”?揭秘全球化架构的时间存储法则

在日常的业务开发中,开发者往往习惯性地将时间打上“UTC+8”(东八区北京时间)的标签直接存入数据库。如果你的系统仅仅服务于国内的单一场景,这或许无可厚非。但在金融系统以及涉外互联网业务的设计标准中,这却

2025年08月07日 其他

常用索引、主键、唯一约束等命名规范

在SQL数据库中,给索引、主键、唯一约束等对象命名时,使用统一的前缀是一种良好的命名规范,有助于提升代码可读性和可维护性。🏷️ 常见SQL对象命名前缀 前缀 含义说明 示例 pk_ 主键(Primary Key) pk_u

WeChat

扫码加我微信

微信二维码