mac 安装HomeBrew,ruby,cocoapods

442 阅读1分钟
  • 下载安装xcode
  • 安装Homebrew
  • 安装rvm
  • 安装ruby
  • 安装cocoapods

安装Homebrew(需要翻墙)

方法一:brew官网的安装脚本

执行命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

这时很可能会出现一个问题: 要么下载极其龟速,要么直接出现如下提示

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

原因:这是 raw.githubusercontent.com 访问不稳定引起的。

此时需要换一种科学高效的安装方法,即方法二。

方法二:brew 镜像安装脚本(亲测最快速最有效)

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

该脚本用了中科大镜像加速访问,仅修改仓库地址部分,不会产生安全隐患。 关于中科大所提供的 Homebrew 镜像服务 lug.ustc.edu.cn/wiki/mirror…

注:注意这里的速度,几百kib/s或几m/s才是正常的。若只有几kib/s,通常为无效的安装方法,一般加载了百分之几十后就会报错。

安装rvm

\curl -sSL https://get.rvm.io | bash -s stable --ruby

如果报# Failed to connect to raw.githubusercontent.com:443,443 端口连接被拒一般是因为墙的原因,如果你可以科学上网(Virtual Private Network)的话,在命令行键以下命令执行:

# 7890 和 789 需要换成你自己的端口
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:789
rvm 相关命令
rvm -v
rvm list known
rvm install 3.0.0
source ~/.rvm/scripts/rvm

image.png

[# Homebrew 踩坑 Error: No similarly named formulae found.](segmentfault.com/a/119000004…)

参考 (ruby) macOS系统更新ruby # Ruby升级的最新方法

# Mac下安装Ruby时遇到的错误:Error running 'requirements_osx_brew_libs_install automake

# Installing Ruby 2.0.0 with RVM and Homebrew on Mac OS X 10.8 Mountain Lion

安装ruby [# Mac OS X 安装Ruby](t.zoukankan.com/ssjf-p-1217…) # Ruby 安装 for Mac(2019/9/3)

# MacOS 10.15.6 最新安装 Cocoapods 教程及问题解决

# cocopods安装权限问题 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write per...

安装cocoapods

# GitHub无法访问、443 Operation timed out的解决办法

# 关于Pod错误:Unable to find a pod with name, author, summary, or description matching

# Creating search index for spec repo 'master'..卡住了