mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

mac 系统偏好设置很卡

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

It’s a time-honored hack: editing the hosts file on your computer to block websites, create local re-directs, and otherwise change what happens when you type particular domains into you address bar.

这是历史悠久的黑客:在计算机上编辑主机文件以阻止网站,创建本地重定向,以及更改在地址栏中键入特定域时发生的情况。

We’ve shown you how to edit your hosts file using the Terminal on your Mac. While that method’s not hard, it’s a little out of the way if you just want to occasionally block Reddit and Facebook, or experiment with re-directing a few domains to your own local servers.

我们已经向您展示了如何使用Mac上的终端编辑主机文件。 虽然这种方法并不难,但是如果您只是想偶尔阻止Reddit和Facebook,或者尝试将一些域重定向到您自己的本地服务器,则有点麻烦。

Happily, there’s Hosts Preference Pane, a tiny application that lets you edit the Hosts file from the macOS System Preferences. To get started, head to the Hosts.prefpane download page and grab the latest version. The download comes in the form of a PKG installer.

令人高兴的是,有一个Hosts Preference Pane ,一个微型应用程序,可让您从macOS系统偏好设置中编辑Hosts文件。 首先,请前往Hosts.prefpane下载页面并获取最新版本。 下载以PKG安装程序的形式出现。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

Open the installer and go through the steps.

打开安装程序,并按照步骤操作。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

When that’s done, open System Preferences and you’ll see a new “Hosts” icon in the bottom row.

完成后,打开系统偏好设置,您将在底行看到一个新的“主机”图标。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

Click this and you’ll be brought to your brand new Hosts preference pane.

单击此按钮,您将进入全新的“主机”首选项窗格。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

Editing the hosts file requires administrator permissions, so to get started you’ll need to click the lock at bottom-left. You’ll be asked for your fingerprint, if you have Touch ID. Otherwise you’ll be asked for your password.

编辑主机文件需要管理员权限,因此,开始之前,您需要单击左下角的锁。 如果您具有Touch ID,则会要求您提供指纹。 否则,将要求您输入密码。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

Note that only administrator accounts can change the hosts file: if you’re not an administrator, this isn’t going to work.

请注意,只有管理员帐户才能更改主机文件:如果您不是管理员,则此操作将无效。

Once everything is unlocked, you can add and remove domains to your liking by using the “+” and “-” buttons at bottom left. If you’ve edited a hosts file before, you know the drill: use “127.0.0.1” as the IP, then add the domains you’d like to block.

解锁所有内容后,您可以使用左下方的“ +”和“-”按钮根据自己的喜好添加和删除域。 如果您以前曾编辑过hosts文件,那么您就会知道演练:使用“ 127.0.0.1”作为IP,然后添加要阻止的域。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

The “use” column, meanwhile, allows you to quickly remove a line from the hosts file without losing track of it. Anything unchecked in the Hosts Preference Pane won’t show up in the actual hosts file, allowing you to quickly remove and re-add domains you need to occasionally use.

同时,“使用”列可让您从主机文件中快速删除一行,而不会丢失它。 主机首选项窗格中未选中的所有内容都不会显示在实际的主机文件中,从而使您可以快速删除并重新添加偶尔需要使用的域。

Any change you make here is instantly made to the hosts file—you can confirm this by heading to /private/etc/ on your computer and opening the hosts file. For our purposes, however, the best check is to open your browser and head to a domain you’ve re-directed.

您在此处所做的任何更改都会立即对hosts文件进行-您可以通过转到计算机上的/ private / etc /并打开hosts文件来确认。 但是,出于我们的目的,最好的选择是打开浏览器并转到您已重定向的域。

mac 系统偏好设置很卡_如何从系统偏好设置编辑Mac的主机文件

If everything is working you should see the change immediately, though sometimes restarting the browser is necessary. Enjoy your new hosts file!

如果一切正常,则应该立即看到更改,尽管有时必须重新启动浏览器。 享受您的新主机文件!

翻译自: https://www.howtogeek.com/313026/how-to-edit-your-macs-hosts-file-from-system-preferences/

mac 系统偏好设置很卡