mac安装brew

brew安装

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

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

默认安装路径:/usr/local/Cellar

如果报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation

解决1、

输入指令:sudo gem install redis

重新安装

解决2、

浏览器输入地址:https://raw.githubusercontent.com/Homebrew/install/master/install

保存网页到本地,命名为brew_install.rb的文件

执行命令:/usr/bin/ruby -e brew_install.rb

解决3、raw.githubusercontent.com 被和谐了

https://www.ipaddress.com/查询raw.githubusercontent.com的真实IP

配置hosts:199.232.68.133 raw.githubusercontent.com

执行安装命令;

 

brew 常用安装命令:

  • brew tap #查看源
  • brew tap source #添加源
  • brew install package #安装软件包
  • brew uninstall package #卸载包
  • brew list #查看安装包
     

brew services命令使用:

  • brew install elasticsearch # 安装 elasticsearch
  • brew services start elasticsearch # 启动 elasticsearch
  • brew services stop elasticsearch # 停止 elasticsearch
  • brew services restart elasticsearch # 重启 elasticsearch
  • brew services list # 列出当前的状态

 

brew Updating Homebrew...   蜗牛

方法一:直接关闭brew每次执行命令时的自动更新(推荐)

 

brew update

vim ~/.bash_profile

# 新增一行

export HOMEBREW_NO_AUTO_UPDATE=true

source ~/.bash_profile

 

方法二:替换更新源

替换更新源

// 执行下面这句命令,更换为中科院的镜像:

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

 

// 把homebrew-core的镜像地址也设为中科院的国内镜像

 

cd "$(brew --repo)"

 

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

 

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

 

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

 

// 更新

brew update

 

// 使用

brew install node

上一篇:Mac电脑brew老安装失败终极解决办法


下一篇:Mac-Homebrew 安装/卸载/更换国内镜像源