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.

UPDATED

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.

MethodBlocks websitesBlocks appsWorks for a set timeAll browsers
Raycast FocusYesYesYes, or no limitMajor browsers
Screen TimeYesWith App LimitsNo, until you change itBest in Safari
Hosts fileYesNoNoYes

Block websites with Raycast Focus

  1. Open Raycast and run Start Focus Session.
  2. Type a Goal, like "Write the report".
  3. Pick a Duration, from 5 minutes to a full day, or leave it as No Limit. You can also type something like until 4:30pm.
  4. Keep the mode on Block Apps & Websites and add what distracts you: youtube.com, x.com, Slack, or a whole category like Social Media.
  5. Press ⌘ ↵ to start.
Start Focus Session sets a goal and a duration, and blocks the sites and apps you choose until it ends.
Start Focus Session sets a goal and a duration, and blocks the sites and apps you choose until it ends.

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.

Pro tip: give Toggle Focus Session a hotkey. It starts a session with your last setup, so one keystroke drops you into focus and the same one ends it.

A few things worth knowing:

  • Allow mode for deep work. Switch the mode to Allow Apps & Websites and list only the two or three things you need. Everything else is blocked.
  • Focus Categories. Group sites and apps once, like "News" or "Social", with Create Focus Category, and drop the whole group into any session.
  • No cheating. You can snooze a block for a few minutes if you really need a site. Set Snooze Duration to No Snooze in Settings → Raycast Focus and the escape hatch is gone.
  • Sleep-aware. If your Mac sleeps, the session pauses and picks up when you're back.
  • Automate it. Focus has Apple Shortcuts actions and deeplinks, so a session can start with your music or your calendar. Or ask Raycast AI: type @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.

Use Screen Time

Screen Time can block websites for good, until you change the setting.

  1. Open System Settings → Screen Time → Content & Privacy and turn it on.
  2. Click Content Restrictions.
  3. Set Access to Web Content to Limit Adult Websites, then click Customize.
  4. Under Restricted, click + and add the sites you want to block.

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.

Edit the hosts file

The hosts file blocks a site in every browser by pointing its address nowhere. It's permanent until you undo it.

  1. Open Terminal and run sudo nano /etc/hosts.
  2. Add a line for each site, for both versions of the address:
0.0.0.0 youtube.com 0.0.0.0 www.youtube.com
  1. Press ⌃ O to save and ⌃ X to quit.
  2. Clear the DNS cache so it takes effect:
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.

New to Raycast?

Here's a quick tour of what else it can do, in under seven minutes:

Frequently Asked Questions

How do I block a website on my Mac for free?

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.

How do I block websites in Chrome on Mac?

Raycast Focus blocks websites in all major browsers, including Chrome, Safari, Arc and Firefox. Screen Time's web restrictions work best in Safari.

Can I block everything except the apps I need?

Yes. In Raycast Focus, switch the mode to Allow Apps & Websites and list only what you need. Everything else is blocked for the session.

How do I unblock a website during a Focus 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.

Does Screen Time block websites in every browser?

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.

Block distracting sites and apps for as long as you need to focus. Try Raycast for free.

Download