How to Block Websites on Mac
Block distracting websites and apps on your Mac while you work, in every browser. How to do it with Raycast Focus for free, and with Screen Time or the hosts file built into macOS.
Block distracting websites and apps on your Mac while you work, in every browser. How to do it with Raycast Focus for free, and with Screen Time or the hosts file built into macOS.
You open a new tab to look something up and land on YouTube out of habit. Twenty minutes later, the doc you were writing is still open in the other window.
The short answer: open Raycast and run Start Focus Session. Type your goal, pick how long, and add the sites and apps that pull you away. Until the session ends, blocked websites show a block page in every major browser, and blocked apps quit as soon as you open them. Raycast Focus is built in and free. To block a site for good, use Screen Time in System Settings.
| Method | Blocks websites | Blocks apps | Works for a set time | All browsers |
|---|---|---|---|---|
| Raycast Focus | Yes | Yes | Yes, or no limit | Major browsers |
| Screen Time | Yes | With App Limits | No, until you change it | Best in Safari |
| Hosts file | Yes | No | No | Yes |
until 4:30pm.youtube.com, x.com, Slack, or a whole category like Social Media.⌘ ↵ to start.
While the session runs, a small Focus Bar floats above your windows with your goal and the time left. Prefer it out of the way? Move it to the menu bar. If you wander onto a blocked site or app anyway, you get an orange glow and a nudge back.
A few things worth knowing:
@raycast-focus and ask it to start a 50-minute session.Focus needs Automation and Accessibility permissions, and Raycast asks for them the first time. Pair it with a Pomodoro timer if you like working in short rounds.
Screen Time can block websites for good, until you change the setting.
To limit apps instead, use Screen Time → App Limits and set a daily time for an app or a category. Screen Time is built for parental controls, so it's a fixed rule rather than a session, and its web restrictions work best in Safari. Turn on Lock Screen Time Settings if you want a passcode between you and the off switch.
The hosts file blocks a site in every browser by pointing its address nowhere. It's permanent until you undo it.
sudo nano /etc/hosts.0.0.0.0 youtube.com
0.0.0.0 www.youtube.com
⌃ O to save and ⌃ X to quit.sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
It's blunt: no schedules, no apps, and you'll need Terminal every time you change your mind.
Here's a quick tour of what else it can do, in under seven minutes:
Raycast Focus is free: start a session, add the websites and apps you want to block, and they stay blocked until the session ends. To block a site permanently, use Screen Time's content restrictions or add it to the hosts file.
Raycast Focus blocks websites in all major browsers, including Chrome, Safari, Arc and Firefox. Screen Time's web restrictions work best in Safari.
Yes. In Raycast Focus, switch the mode to Allow Apps & Websites and list only what you need. Everything else is blocked for the session.
Snooze the block for that site (3 minutes by default) or pause the session. To remove the temptation, set Snooze Duration to No Snooze in Settings → Raycast Focus, and pausing is the only way through.
Screen Time's web content restrictions are built for Safari. Other browsers may not respect them, which is why many people use a blocker that works across browsers.
More guides
Set a countdown timer on your Mac for tea, laundry or a focus session. Three ways to do it: the free Timers extension for Raycast, the Clock app, and Siri.
Find out what time it is in Tokyo, or what 5 PM in London is in San Francisco, without opening a website. With Raycast's calculator, a teammate list in your menu bar, and the Clock app.
Run 25-minute focus sessions and short breaks on your Mac, with the countdown in your menu bar. How to do it with Raycast, and with the timers already built into macOS.
Stop your Mac from sleeping during downloads, presentations and long builds. Three ways to keep it awake: System Settings, the caffeinate command, and the free Coffee extension.
