Can't block websites using Terminal
Hey everyone, having some trouble with the below and wanted to see if anyone has solutions or ideas! Asked around, even in Reddit, without any luck so far:
PROBLEM:
Can’t block websites for productivity via hosts in Terminal on personal computer. Don't want to use Screen Time because it's easy to workaround.
It worked successfully on my work computer, so know it's possible. However, no luck on my personal computer. They’re the same Mac models and I’m using the same WiFi router for both.
MAC DETAILS:
MacBook Pro, 2023 with Ventura 13.4.
SO FAR:
I’ve followed all of the below instruction and, again, it worked on my work computer, but not personal one:
- Type in the command below and press Return on your keyboard. This will open the hosts file: sudo nano -e /etc/hosts
- Use the arrow keys to go to the bottom of the line. Type 127.0.0.1 and the website address you want to block. For example, to block YouTube, I would enter the following in Terminal: 127.0.0.1 www.instagram.com
- Type each website on a separate line. Once you’re done, press Control + O followed by Return on your keyboard to save the file, and then Control + X to close the file.
- Type the following command to flush the cache, which will enforce these changes across the browsers. Press Return to enter the command: sudo dscacheutil -flushcach (I've also tried: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder)
Full instructions found here.
TROUBLESHOOTING ATTEMPTS:
- Tried different variations of the URLs:
- with/without www.
- with/without https://
- Tried using 0.0.0.0
- Tried using with and without a tab after the numbers
- Cleared caches (Safari & deleted caches out of Finder folder), restarted, etc.
While these forum posts are older, I tried them without luck:
Here's what I'm seeing on my end for a quick example:
Any help will be much appreciated and hope it helps others in the same boat... thank you!
MacBook Pro 14″, macOS 13.4