guide
How to Block Distracting Websites on Mac
Three methods, from easy to unbreakable. Choose based on how serious you are.
If you're reading this, you already know the problem. You sit down to work, and 45 minutes later you're deep in a Twitter thread or a YouTube rabbit hole. Here are three ways to stop it on macOS, ranked from simplest to most effective.
Method 1: Screen Time (built-in, easy to bypass)
macOS has website blocking built into Screen Time. Here's how to set it up:
- Open System Settings and click Screen Time
- Click Content & Privacy
- Turn on Content & Privacy Restrictions
- Under Web Content, choose Limit Adult Websites
- Click Customize and add sites to the Restricted list
The problem: Screen Time is designed for parental controls, not self-control. You can turn it off with your own password anytime. It also only works in Safari, not Chrome, Arc, or other browsers.
Method 2: Edit the hosts file (free, technical)
The hosts file on macOS maps domain names to IP addresses. You can redirect distracting domains to 127.0.0.1 (your own computer), which makes them unreachable.
sudo nano /etc/hosts Add lines like:
127.0.0.1 twitter.com
127.0.0.1 www.twitter.com
127.0.0.1 x.com
127.0.0.1 www.x.com
127.0.0.1 reddit.com
127.0.0.1 www.reddit.com Then flush the DNS cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder This works across all browsers and apps. The problem: you can just edit the file again to unblock sites. It also requires you to remember the terminal commands, and there's no scheduling or time limits.
Method 3: Use Sloth (strongest, can't bypass)
Sloth automates what the hosts file does, but adds two more blocking layers (firewall rules and browser redirect) and wraps it in a locked daemon that you can't turn off.
Here's what that looks like in practice:
- Open Sloth and tap a preset (like "deep work")
- Choose a duration and turn on the lock
- The sites are blocked. All browsers. You can't undo it.
Behind the scenes, Sloth injects entries into your hosts file, creates packet filter firewall rules for the blocked domain IPs, and monitors your browser tabs. If you try to visit a blocked site, you see a clean "blocked" page with a countdown.
You can also set recurring schedules (like "block social media every weekday 9-5") and daily budgets (like "20 minutes of Twitter per day, then it's blocked until tomorrow").
Which method should you use?
If you just want to reduce temptation, Screen Time is fine. If you want a free technical solution that works across all browsers, edit your hosts file.
If you've tried willpower and it hasn't worked, if you've turned off every blocker you've installed within an hour, Sloth is the only one that takes the decision out of your hands. That's the point. When you can't cheat, you don't.
Ibo Gonzales
productivity researcher and founder of sloth