Phos Download

How to block websites on a Mac

There are four real ways to block a website on a Mac. They differ in two ways that matter: whether they work in every browser, and how easy they are for you to undo at 11 pm.

By Andrew Hodges, maker of Phos · Updated · 3 min read

Quick comparison

MethodWorks in every browserTime limits or schedulesEasy to undo?Cost
Screen Time content filterMostlyDowntime onlyPasscodeFree
Hosts fileYesNoVery easy if you know howFree
Browser extensionOnly that browserDependsVery easyOften free
Blocker appYes (most)YesDesigned to be hardFree to paid

Method 1: Screen Time (built in)

Screen Time can restrict websites, but only in two ways: limit adult content with a list of extra blocked sites, or allow only a list of approved sites.

  1. Open System Settings → Screen Time. Turn on Screen Time if it's off.
  2. Click Content & Privacy and turn it on.
  3. Click Store Restrictions / Content Restrictions (the name depends on your macOS version) and find Access to Web Content.
  4. Choose Limit Adult Websites, then click Customize and add sites under Restricted.
  5. Set a Screen Time passcode in Screen Time settings so the rules can't be changed without it.

The downsides: the adult-content filter also blocks some sites you didn't ask for, and if you set the passcode yourself, you also know it.

Method 2: The hosts file (free, works everywhere)

The hosts file tells your Mac where to find websites. Pointing a site at nowhere blocks it in every browser and app.

  1. Open Terminal and run: sudo nano /etc/hosts
  2. Enter your Mac password.
  3. At the bottom, add one line per site, for example: 0.0.0.0 youtube.com and 0.0.0.0 www.youtube.com
  4. Save with ⌃ O, press Return, then exit with ⌃ X.
  5. Flush the DNS cache: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

It's free and thorough, but you have to list every subdomain yourself (m., www. and so on), there's no schedule, and undoing it takes 30 seconds. Some browsers with secure DNS turned on may also bypass it.

Method 3: A browser extension

Extensions like BlockSite or LeechBlock block sites inside one browser, often with schedules and time limits. They're easy to set up and easy to get around: switch browsers, open a private window or disable the extension.

Method 4: A blocker app

Dedicated apps block across browsers, add schedules and time limits, and make undoing a block deliberately slow. A few options:

  • Phos blocks sites in Safari, Chrome, Brave, Arc, Edge and its own browser, subdomains included, with daily limits, focus sessions and a nightly wind-down. Loosening a rule takes the passcode and a ten-minute wait. It also turns the screen grayscale and warm, which makes the sites less tempting in the first place. $19.99 once.
  • SelfControl is free and blocks a list of sites until a timer ends, even through restarts.
  • Cold Turkey and Freedom offer deep scheduling and whole-internet blocks.

We compare them all in The best app blockers for Mac.

Which method should you use?

  • One site, occasionally: the hosts file.
  • Kids or a shared Mac: Screen Time with a passcode someone else sets.
  • Your own habits: a blocker app, because the thing you're defending against is yourself at a weak moment, and that version of you knows how to edit a hosts file.

Frequently asked questions

How do I block a website on Safari on Mac?

Use Screen Time (System Settings → Screen Time → Content & Privacy → Access to Web Content → Limit Adult Websites → Customize) or a blocker app like Phos that supports Safari.

How do I block a website on Chrome on Mac?

Screen Time's content filter covers Chrome in most cases. For specific sites with schedules, use a blocker app that supports Chrome, or the hosts file.

How do I block YouTube on my Mac?

Add youtube.com and www.youtube.com (and m.youtube.com) to the hosts file, or block YouTube in a blocker app that handles subdomains for you, like Phos.

How do I unblock a website on Mac?

Remove it from wherever you blocked it: the Screen Time Restricted list, the hosts file (then flush DNS), the extension, or the blocker app. In Phos, loosening a rule needs the passcode and a ten-minute wait.