1. 为macOS终端设置代理

2. 检查代理是否设置成功

3. 如果无法ping通www.google.com,则修改hosts文件
- 打开Finder
- 按下快捷键
Shift+Command+G - 输入
/etc/hosts - 在hosts文件最后添加一行
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
185.199.108.133 raw.githubusercontent.com4. 网络环境解决后,开始安装Homebrew
- 在终端中复制如下代码,按下
Enter开始运行:
/bin/bash -c"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- 输入Mac密码,获得超级管理员权限

- 按下
Enter继续安装

- 安装成功,提示警告
/opt/homebrew/bin不在路径中

- 如果是intel芯片,无视该警告就行;
- 如果是Apple M系列芯片,请添加两条命令
Next steps:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/longhui/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"5. 学习homebrew管理和安装软件相关命令
- 查询brew相关命令:
brew help

- brew命令分为内建普通命令和内建开发者命令


- 常用的几个brew命令: 以笔记软件Notion为例:

brew update——更新homebrew本体brew outdated——列出过时的软件brew upgrade——更新homebrew管理的所有过时软件brew search+software——查找软件brew info+software——显示软件简介brew home+software——打开软件官网brew install+software——安装软件brew uninstall+software——卸载软件brew install --adopt——接管非homebrew渠道安装的软件
现在新增了一个非常实用的选项--adopt。这很好地解决了用 Homebrew 管理图形界面软件时,与用户手动安装版本以及软件的自动更新功能「打架」的问题。例如在以前,如果你从官网下载安装过 Notion,然后忘记了这回事,试图用 Homebrew 安装或更新,就会看到「软件已存在」的报错信息。这显然非常不智能:用户没有义务记住每个软件最初的安装渠道;既然已经装过了,那就没必要再装一遍,直接「接管」这个版本,以后一并纳入 Homebrew 的管理范围。(这段来源少数派作者)
platyhsu@forsa ~ % brew install notion
--adopt
==
> Downloading https://desktop-release.notion-static.com/Notion-2.1.12-arm64.dmg
######################################################################## 100.0%
==
> Installing Cask notion
==
> Purging files
for
version
2
.1.12 of Cask notion
==
> Installing Cask notion
==
> Adopting existing App at
'/Applications/Notion.app'
🍺 notion was successfully installed!
