1. 打开终端,输入并运行下面的命令: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts 2. 会自打开hosts文本,可在上面直接修改。 如下图: 或sudo vim /etc/hosts 这个更方便