在 Mac 上使用終端阻止網站
Mac OS X has Hosts file just like Windows. We can edit Hosts via Terminal on a Mac to block specific websites that are not allowed to visit.
- To edit the hosts file and add a new blocking entry, open up your Terminal and type the following command line (You’ll be asked for your root password because this is a system file):
sudo nano /etc/hosts
- This will bring up a Nano box that looks like the one below. Yahoo has been added to block list as you can see. To block any other site, simply type it in the same format.
one line, one site. And don’t forget to add “www"如果 URL 有首碼"www”, or it will not work with Safari.
- 點擊 CTRL 鍵+X and Press Y in your keyboard to save modified buffer, and then press Enter to go back to Terminal.
- Please run the following command in Terminal to take the changes take into effect:
If you are using Mac OS 10.4.X, please type the following and press Enter:
lookupd –flushcacheFor Mac OS 10.5.X and later, it can be done by entering the following and press Enter:
sudo dscacheutil –flushcache
By modifying the Hosts file we can block any sites we want to on Mac. But we do not suggest it when you are not Mac savvy enough. There is an easy alternative for you: using Mac 的奧博 Web 篩選器. It makes the blocking work more convenient and powerful.Download Aobo Internet Filter for Mac Free Trial Instantly!
類別: 篩選器 Mac 學習中心