安装homebrew

最近换电脑再安装ruby时提示需要先安装brew,但是很多brew安装方式已经失效,最后使用金牛肖马 的方法解决的此问题,这里记录一下流程:

在终端输入命令:

haoxiaozi@haoxiaozideMacBook-Pro ~ % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

选择网络推荐使用1,速度最快

提示安装成功后查看版本brew -v

haoxiaozi@haoxiaozideMacBook-Pro ~ % brew -v 
Homebrew 3.6.7-32-g31758ea
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)

出现部分文件权限异常,按照说明分别输入命令 

haoxiaozi@haoxiaozideMacBook-Pro ~ % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
haoxiaozi@haoxiaozideMacBook-Pro ~ % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

再次查看版本

haoxiaozi@haoxiaozideMacBook-Pro ~ % brew -v
Homebrew 3.6.7-32-g31758ea
Homebrew/homebrew-core (git revision e22841dbb48; last commit 2022-10-28)
Homebrew/homebrew-cask (git revision 23ab0f2d6b; last commit 2022-10-28)

 OK,brew彻底安装完成

安装ruby最新环境

haoxiaozi@haoxiaozideMacBook-Pro ~ % rvm install 3.0.0

下载完成查看对应版本

haoxiaozi@haoxiaozideMacBook-Pro ~ % rvm list
=* ruby-3.0.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

下面就可以进行其他事情

 最后感谢大佬金牛肖马​​​​​​​,插眼记录以备后用。

你可能感兴趣的:(环境搭建,开发常识,常见错误,ruby,Homebrew)