Homebrew安装/使用(Ubuntu&zsh)

2020-04-14  本文已影响0人  Cyn_TZII
  • 简介: Homebrew是一个在MacOS或Linux上的软件包管理工具, Homebrew 会将软件包安装到独立目录,并将其文件软链接至 /usr/local
  • Homebrew官网: https://brew.sh/

安装

在Terminal输入

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

Homecrew会被利用sudo被安装至/home/linuxbrew/.linuxbrew~/.linuxbrew, 安装后不会再使用sudo. 使用/home/linuxbrew/.linuxbrew会允许使用比在个人主目录下更多的二进制包.

安装时若报错: curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
浏览器登录:https://raw.githubusercontent.com/Homebrew/install/master/install
若无问题, 显示:

https://raw.githubusercontent.com/Homebrew/install/master/install截图
等待后重试安装语句

若无法显示网页,检查网络连接

将Homebrew加入PATH

test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile

对于zsh用户: 还需

test -r ~/.zsh_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.zsh_profile
echo "export PATH=$HOME/bin:/usr/local/bin:$PATH" >> ~/.zshrc                                            
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.zshrc 
source ~/.zshrc 

测试brew install hello

截图

安装完毕


brew常用命令

更多命令&FAQ: Homebrew文档

上一篇下一篇

猜你喜欢

热点阅读