Guides / System-Wide Website Blocking on Mac
How do I block YouTube on a Mac?
Block YouTube at the system level, not inside one browser. Add YouTube's domains to the hosts file or use a blocker that works system-wide, then clear the DNS cache so the change applies. A browser extension only guards the browser it is installed in, so anyone who opens a second browser walks straight around it.
Why blocking YouTube in one browser does not hold
Most Macs have more than one browser. Safari comes with the system, and people add Chrome, Arc or Firefox on top. A YouTube blocker that lives inside one browser guards one door. Open another browser and YouTube loads like nothing happened.
The fix is to block below the browser, where every browser has to ask the same question: where does this site live? There are three practical ways to do that on a Mac: edit the hosts file, use Screen Time web restrictions, or use a blocker that works system-wide.
Method 1: block YouTube with the hosts file
The hosts file tells your Mac to send certain domains nowhere. It is free, built in, and applies to every browser because they all resolve names through the system. Web apps saved to your Dock load the same domains, so they hit the wall too.
- Open Terminal.
- Run: sudo nano /etc/hosts, then enter your password.
- At the bottom, add one line per hostname: 0.0.0.0 youtube.com, 0.0.0.0 www.youtube.com, 0.0.0.0 m.youtube.com and 0.0.0.0 youtu.be.
- Save with Control-O and Enter, then exit with Control-X.
- Flush the DNS cache with: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Know the limits. The hosts file has no wildcards, so you list every hostname yourself, and a missed one leaks through. Embedded videos can load from other YouTube domains such as youtube-nocookie.com. A browser with its own secure DNS setting may behave differently, so test the block in each browser you use.
The bigger weakness is that there is no timer and no lock. The Terminal command that adds the line removes it. One weak afternoon and the block is gone.
Method 2: Screen Time web restrictions
Screen Time in System Settings can restrict websites under Content & Privacy. You add youtube.com to the restricted list and protect the settings with a Screen Time passcode. It takes a couple of minutes and needs nothing extra installed.
The catch is that it is a standing rule, not a session. It is on until someone turns it off, and that someone can be you. Before you trust it, open YouTube in every browser you actually use and confirm it holds.
Method 3: block YouTube system-wide with bloq
bloq is an app blocker for iPhone and Mac. On Mac, website blocking is system-wide, so Safari, Chrome, Arc and any other browser all hit the same wall. You set it up once. There is no per-browser extension and no hosts file to maintain.
- Download bloq for Mac from bloq.ac. It is a direct download, free to start, and you do not need an account to try it.
- Create a block list and add YouTube as a website.
- Pick how long the focus session runs and start it with that list selected.
- Open YouTube in any browser. It is redirected back to bloq.
The session blocks for its full length. A bloq ends when the timer ends, not when the craving does. For a deeper look at how this works on Mac, read what a system-wide website blocker is or the guide to blocking websites on Mac in every browser.
Make the block hold when you want YouTube back
A block you can undo in a weak moment is a suggestion. Turn on Super Strict Mode before you start a session. While the timer runs you cannot pause it, stop the session, or edit the active block list, and you cannot delete the app either. It cannot be disabled mid-session, so use it wisely. How Super Strict Mode works covers the details.
A few other settings fit YouTube specifically:
- Scheduled sessions start focus sessions for you, so your work hours begin blocked without you deciding anything. Schedules sync across iPhone and Mac through your account.
- Daily usage limits suit people who need YouTube for the odd tutorial. A limit session watches how long you use the selected sites each day. Once you pass your allowance, for example 30 minutes, they are blocked until midnight, when the counter resets. On Mac, time counts while the site is active in front of you.
- Your iPhone is the usual escape route. Add the YouTube app and site to a block list there. Starting a session on your Mac blocks the iPhone at the same moment, as long as Background App Refresh is on for bloq. iOS never wakes a force-quit app, and opening bloq always applies the block right away.
When blocking YouTube is the wrong tool
If YouTube is part of your job, a hard block gets in your way. Lectures, tutorials and reference videos are better served by a usage limit or a schedule than by an all-day wall.
Also expect the habit to move. Block YouTube and you may drift to the next feed. Add that site to the same list, like Reddit, and read how to stop doomscrolling for tactics that hold. If you are comparing tools first, see the top 5 app blockers for Mac.
Try it
bloq locks distracting apps and websites on your Mac and iPhone at once. Start a session on one device and the other locks the same second.
Frequently asked questions
Can I block YouTube in just one browser on Mac?
Yes, a browser extension does that. It only covers the browser it is installed in, so switching to another browser bypasses it. A system-wide block covers all of them.
Does blocking YouTube on my Mac also block it on my iPhone?
System-wide website blocking is a Mac feature. On iPhone you add the YouTube app and website to a block list. Starting a session on one device blocks the other, provided Background App Refresh is on for bloq on the iPhone.
How do I undo a hosts file block?
Open the file again with sudo nano /etc/hosts, delete the YouTube lines or put a # in front of them, save, and flush the DNS cache. That ease is also why the hosts file is a weak guard against yourself.
Can I block YouTube only during work hours?
Yes. Scheduled sessions start focus sessions automatically, so YouTube is blocked at the times you pick. The hosts file has no schedule of its own.
Is bloq free for blocking YouTube on Mac?
bloq is free to start, and you do not need an account to try it. Sync between iPhone and Mac runs through your account.