How to Block Specific Websites in Safari on Mac

What the editor is talking about here is to block specific websites by modifying system files (of course there are other ways, such as: 1, create a new login account, and then perform parental control; 2, install third-party application software Self Control; 3, other methods).

The screenshot of Xiaobian's system information is as follows:
write picture description here

Step 1: Open a terminal

write picture description here

write picture description here

write picture description here

Step 2: Enter sudo pico /etc/hosts in the terminal

write picture description here
After entering sudo pico /etc/hosts, then "Enter", then you need to enter the login password of the account.
write picture description here
Then enter text editing:
write picture description here
move the cursor to the last line.
write picture description here

Step 3: Add the website address that needs to be blocked

In the cursor position of the text editor opened in the second step (it has moved to the end), enter:
127.0.0.1 www.bilibili.com
(the website www.bilibili.com is blocked here)
Note: Do not have "http" in front of the URL ://"
Note: Do not have "http://"
in front of the URL Note: Do not have "http://" in front of the URL,
write picture description here
then press Ctrl+O to save the modification,
write picture description here
then press "Enter" to confirm the modification
write picture description here
and then press "Ctrl+X" Exit the text editor and go back to the terminal.
write picture description here

Step 4: Update the cache

Type: sudo dscacheutil -flushcache
write picture description here
and press "enter"
write picture description here

At this time, if the above operations are not wrong, the "www.bilibili.com" website should have been blocked.
write picture description here

other instructions

Article reference: https://www.igeeksblog.com/how-to-block-websites-on-safari-on-mac-os-x-yosemite/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325650585&siteId=291194637