mirror of
https://gitee.com/ineo6/homebrew-install.git
synced 2025-04-06 03:58:05 +08:00
commit
afdd49c32b
@ -41,6 +41,7 @@ export default defineConfig({
|
||||
navs: [
|
||||
null,
|
||||
{ title: 'GitHub', path: 'https://github.com/ineo6/homebrew-install' },
|
||||
{ title: 'GitMaster', path: 'https://github.com/ineo6/git-master' },
|
||||
],
|
||||
menus: {
|
||||
'/guide': [
|
||||
|
@ -58,36 +58,36 @@ Use '--' to separate paths from revisions, like this:
|
||||
|
||||
一般是环境变量无效,请使用`echo $SHELL`确认终端类型,参考上节。
|
||||
|
||||
如果是`m1`芯片`Mac`则可能是没有把`/opt/homebrew/bin`加入环境变量:
|
||||
`m1`芯片`Mac`电脑需要手动设置环境变量:
|
||||
|
||||
zsh
|
||||
|
||||
```shell
|
||||
echo export PATH=/opt/homebrew/bin:$PATH >> ~/.zprofile
|
||||
source ~/.zprofile
|
||||
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
bash
|
||||
|
||||
```shell
|
||||
echo export PATH=/opt/homebrew/bin:$PATH >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
否则可能因为特殊情况需要把`/usr/local/bin`手动加入环境变量:
|
||||
非`m1`的话,可以尝试手动加入环境变量:
|
||||
|
||||
zsh
|
||||
|
||||
```shell
|
||||
echo export PATH=/usr/local/bin:$PATH >> ~/.zprofile
|
||||
source ~/.zprofile
|
||||
echo 'eval "$(/usr/local/Homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
bash
|
||||
|
||||
```shell
|
||||
echo export PATH=/usr/local/bin:$PATH >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
echo 'eval "$(/usr/local/Homebrew/bin/brew shellenv)"' >> ~/.bash_profile
|
||||
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
## SHA256 mismatch
|
||||
|
@ -25,30 +25,30 @@
|
||||
然后还需设置环境变量,在`~/.zprofile`或者`~/.bash_profile`文件末尾追加下面代码:
|
||||
|
||||
```shell
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
具体操作步骤如下,一定要仔细阅读。
|
||||
**具体操作步骤如下,一定要仔细阅读。**
|
||||
|
||||
PS: 终端类型根据执行命令`echo $SHELL`显示的结果:
|
||||
|
||||
- `/bin/bash` => `bash` => `.bash_profile`
|
||||
- `/bin/zsh` => `zsh` => `.zprofile`
|
||||
- `/bin/bash` => `bash` => `.bash_profile`
|
||||
|
||||
**如果遇到环境变量无效问题,建议回过头来查看终端类型,再做正确的设置。**
|
||||
|
||||
从`macOS Catalina`(10.15.x) 版开始,`Mac`使用`zsh`作为默认`Shell`,使用`.zprofile`,所以对应命令:
|
||||
|
||||
```shell
|
||||
echo export PATH=/opt/homebrew/bin:$PATH >> ~/.zprofile
|
||||
source ~/.zprofile
|
||||
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
如果是`macOS Mojave` 及更低版本,并且没有自己配置过`zsh`,使用`.bash_profile`:
|
||||
|
||||
```shell
|
||||
echo export PATH=/opt/homebrew/bin:$PATH >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
```
|
||||
|
||||
扩展阅读:[在 Mac 上将 zsh 用作默认 Shell](https://support.apple.com/zh-cn/HT208050)
|
||||
|
@ -81,8 +81,8 @@ brew update
|
||||
|
||||
执行命令`echo $SHELL`,根据结果判断:
|
||||
|
||||
- `/bin/bash` => `bash` => `.bash_profile`
|
||||
- `/bin/zsh` => `zsh` => `.zprofile`
|
||||
- `/bin/bash` => `bash` => `.bash_profile`
|
||||
|
||||
然后继续正式操作,以**中科大源**为例:
|
||||
|
||||
@ -155,7 +155,11 @@ source ~/.zprofile
|
||||
|
||||
## 如果对您有帮助
|
||||
|
||||
分享、收藏,能让更多人能发现文章,这也是对我的认可和鼓励,谢谢。
|
||||
您可以考虑请我喝杯咖啡。
|
||||
|
||||
当然分享、收藏,能让更多人能发现文章,这也是对我的认可和鼓励。
|
||||
|
||||

|
||||
|
||||
## 参考文章
|
||||
|
||||
|
@ -7,7 +7,9 @@ sidemenu: false
|
||||
|
||||
# 赞赏
|
||||
|
||||
如果我的工作帮助到你,可以请我喝杯咖啡。
|
||||
如果我的工作帮助到你,您可以考虑请我喝杯咖啡。
|
||||
|
||||
当然分享、收藏,能让更多人能发现文章,这也是对我的认可和鼓励。
|
||||
|
||||
| 微信 | 公众号 |
|
||||
| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
|
12
install.sh
12
install.sh
@ -727,6 +727,8 @@ ohai "Downloading and installing Homebrew..."
|
||||
) || exit 1
|
||||
|
||||
if [[ ":${PATH}:" != *":${HOMEBREW_PREFIX}/bin:"* ]]; then
|
||||
warn "!!!!!!!!!!! 重要 !!!!!!!!!!!!!!!"
|
||||
warn "看到此提示,一定要执行 Next steps 中的 环境变量设置!!!"
|
||||
warn "${HOMEBREW_PREFIX}/bin is not in your PATH."
|
||||
fi
|
||||
|
||||
@ -775,11 +777,14 @@ case "$SHELL" in
|
||||
;;
|
||||
esac
|
||||
if [[ "$UNAME_MACHINE" == "arm64" ]] || [[ -n "${HOMEBREW_ON_LINUX-}" ]]; then
|
||||
warn "!!!!!!!!!!! 重要 !!!!!!!!!!!!!!!"
|
||||
echo "切记执行环境变量设置!,如已执行过请忽略。"
|
||||
cat <<EOS
|
||||
- Add Homebrew to your ${tty_bold}PATH${tty_reset} in ${tty_underline}${shell_profile}${tty_reset}:
|
||||
- 添加 Homebrew 到 ${tty_underline}${shell_profile}${tty_reset} 文件的 ${tty_bold}PATH${tty_reset} 中,执行下面命令即可:
|
||||
echo 'eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"' >> ${shell_profile}
|
||||
eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"
|
||||
EOS
|
||||
echo " 如有疑问,可以访问 ${tty_underline}https://brew.idayer.com/guide/m1/${tty_reset}"
|
||||
fi
|
||||
if [[ -n "${non_default_repos}" ]]; then
|
||||
s=""
|
||||
@ -791,9 +796,10 @@ if [[ -n "${non_default_repos}" ]]; then
|
||||
printf " %s\n" "${additional_shellenv_commands[@]}"
|
||||
fi
|
||||
|
||||
echo "- Run \`brew help\` to get started"
|
||||
echo "- Further documentation: "
|
||||
echo "- 运行 \`brew help\` 开始体验吧"
|
||||
echo "- 更多文档: "
|
||||
echo " ${tty_underline}https://docs.brew.sh${tty_reset}"
|
||||
echo " ${tty_underline}https://brew.idayer.com${tty_reset}"
|
||||
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]; then
|
||||
echo "- Install the Homebrew dependencies if you have sudo access:"
|
||||
|
Loading…
x
Reference in New Issue
Block a user