How to Block YouTube on a Mac (Safari, Chrome and System-Wide)
Block YouTube on your Mac in Safari, Chrome or every browser. Compare Screen Time, the hosts file and a browser extension, with step-by-step instructions.
You open a new tab, type "you", and YouTube fills in the rest before you've decided to watch anything. That's the problem with blocking YouTube on a Mac: the site is always one keystroke away, and macOS doesn't have a single switch that says "not this website."
The quick version: for most people, the best way to block YouTube on Mac is a browser extension in Chrome, Edge, Brave or Firefox, because it can enforce daily limits and schedules without blocking the rest of the internet. If you need a hard block that also covers Safari, Screen Time or the hosts file will do it, each with a different trade-off. This guide walks through all of them so you can pick the one that fits how you actually use your Mac.
In this guide
- Why the browser matters on a Mac
- Method 1: Block YouTube on Mac with Obserra
- Method 2: Use macOS Screen Time
- Method 3: Block YouTube with the hosts file
- Method 4: Block it on your router or DNS
- Which setup fits your Mac?
- What if only Shorts are the problem?
- Frequently asked questions
Why the browser matters on a Mac
On Windows there's usually one obvious browser. On a Mac there are at least two: Safari, because it's the default, and Chrome, because a lot of people install it out of habit. Add Firefox, Edge or Brave and the picture gets messier.
That matters because Apple's own controls are not browser-neutral. Screen Time's web restrictions reliably apply to Safari and apps built on WebKit. Chrome and Firefox use their own engines and generally ignore those restrictions. So the method you choose has to match the browser where you actually watch YouTube.
If you're not sure which browser you're in, look at the name next to the Apple menu at the top of the screen. That's the app you'd be blocking.
Method 1: Block YouTube on Mac with Obserra
Obserra is a free extension for Chrome, Edge, Brave and Firefox. It isn't available for Safari, so if Safari is your only browser, skip to Screen Time below.
What makes it a better fit than the blunt methods is that it works like a set of rules rather than a wall. You can:
- set a daily time limit or a daily video limit;
- block YouTube only during work or study hours with Time Blocks;
- limit specific channels or genres while leaving the rest of YouTube available;
- hide recommendations, Shorts and other distracting parts of the interface.
-
Create your account. Register at obserra.com with your email or Google account.
-
Install the extension in the browser you watch in. Follow the download instructions for Chrome, Edge, Brave or Firefox, then sign in with the same account.
-
Choose how YouTube should be blocked. Open the settings page and pick the option that matches the problem:
- Daily Limit caps your total watch time for the day.
- Daily Video Limit caps the number of videos instead of the minutes, which suits the "just one more" loop.
- Time Blocks block YouTube during hours you choose, such as 09:00 to 17:00.
- Client Modifications hide the homepage feed, sidebar suggestions, end screens and Shorts if the interface itself is the problem.
-
Test it. Open YouTube in that browser and check that the limit or block applies. If you set a Time Block, test it during the blocked hours rather than outside them.
One limitation worth stating plainly: the extension only controls the browser it's installed in. If you watch YouTube in Safari on the same Mac, nothing changes there. It also doesn't control the YouTube app on your phone or TV; the Obserra iOS and Android apps cover limits on mobile.
Ready to set it up? Create a free Obserra account, install the extension in the browser you use, and choose your first limit.
Method 2: Use macOS Screen Time
Screen Time is built into macOS and doesn't require installing anything. It's the right tool if you use Safari, or if you're setting up a child's Mac and want a block they can't casually undo.
- Open System Settings from the Apple menu, then click Screen Time in the sidebar.
- Click Content & Privacy and turn on Content & Privacy Restrictions.
- Under Content Restrictions, open Access to Web Content and select Limit Adult Websites.
- Click Customize next to it. Under Never Allow, add youtube.com, www.youtube.com, m.youtube.com, youtu.be and music.youtube.com.
- Close Settings and open YouTube in Safari to check it's blocked.
The catch is the same one that applies to the whole guide: these web restrictions are not enforced in Chrome or Firefox. They cover Safari and apps built on WebKit, which is fine for a Safari-only setup and useless if you watch in Chrome.
Two other limitations are worth knowing. Screen Time is designed as parental-control software, so without a Screen Time passcode you can switch it off in seconds. Set a passcode if you want it to be a real barrier. And because it blocks the domain rather than the site's player, YouTube embeds in Safari will fail too.
If you're setting this up for a child, use it alongside Family Sharing so the restrictions apply across their Apple devices. For your own Mac, treat it as a Safari-only measure rather than a complete solution.
Method 3: Block YouTube with the hosts file
The hosts file is the nuclear option. It tells macOS where to find a domain before DNS does. Point YouTube's domains at your own machine and every browser on that Mac fails to load them.
Before you start, know that this blocks YouTube everywhere on the Mac, including tutorials, embeds and any app that loads the domain. It's all-or-nothing, with no schedules or limits.
- Open Terminal from Spotlight or Applications > Utilities.
-
Back up the file first, so you can undo the change later:
sudo cp /etc/hosts /etc/hosts.backup -
Open the file in the nano editor:
sudo nano /etc/hosts -
Add these lines at the bottom. Use both IPv4 and IPv6 entries, because macOS looks them up separately; blocking only IPv4 is the usual reason a YouTube block silently fails:
0.0.0.0 youtube.com
::1 youtube.com
0.0.0.0 www.youtube.com
::1 www.youtube.com
0.0.0.0 m.youtube.com
::1 m.youtube.com
0.0.0.0 music.youtube.com
::1 music.youtube.com
0.0.0.0 youtu.be
::1 youtu.be - Save with Control + O, press Enter to confirm, then exit with Control + X.
-
Flush the DNS cache so the change takes effect:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Quit and reopen your browser, then try to load YouTube. If Chrome still loads it, open chrome://net-internals/#dns and clear the host cache.
To undo it, restore the backup and flush the cache again:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
The honest downside: you can undo this in under a minute, so it won't stop an impulse if you know the commands. It works best as a deliberate barrier, not as a test of willpower. It also only affects that Mac; your phone and other devices are untouched.
Method 4: Block it on your router or DNS
If you want YouTube blocked on the Mac and every other device in the house, do it at the router or with a filtering DNS service. Log in to your router's admin page and look for Parental Controls, Website Blocking or Access Restrictions. Add youtube.com to the blocked list.
The block covers every device on Wi-Fi, but it disappears the moment a phone switches to mobile data, and it affects everyone, including people who need YouTube for work or school. For a family that's often the right trade-off. For your own focus, it's usually too broad.
Which setup fits your Mac?
- You use Chrome, Edge, Brave or Firefox and want limits or schedules: use Obserra. It's the only option here that can block work hours, cap your watch time, or limit only Shorts and specific channels.
- You use Safari and don't want to install anything: use Screen Time, and set a passcode if you want the block to stick.
- You want YouTube gone in every browser on one Mac: edit the hosts file.
- You're setting up a child's Mac: Screen Time with a passcode, ideally managed through Family Sharing.
- You want to cover the whole household: block it at the router or with a filtering DNS service, then use an extension on your own machine for more control.
What if only Shorts are the problem?
You don't have to block YouTube completely. On a Mac, use Obserra in Chrome or Firefox to disable Shorts and hide the homepage feed, then set a daily Shorts limit in the iOS or Android app if your phone is part of the habit. Normal videos and search stay available, which is easier to live with than a full ban.
Start with how to limit and block YouTube Shorts, then use blocking YouTube recommendations if the homepage feed is what pulls you back in.
Frequently asked questions
Does Obserra work in Safari on a Mac?
No. Obserra supports Chrome, Edge, Brave and Firefox. If Safari is your only browser, use Screen Time or the hosts file instead. If you're willing to watch YouTube in Chrome or Firefox, the extension is the more flexible option.
Why doesn't Screen Time block YouTube in Chrome?
Apple's web content restrictions apply to Safari and apps built on WebKit. Chrome uses its own engine and generally ignores them. Use a browser extension or the hosts file if Chrome is where you watch.
Can I block YouTube only during work hours on a Mac?
Yes, with Obserra's Time Blocks. Set a range such as 09:00 to 17:00 and YouTube is blocked in that browser during those hours. See our guide to blocking YouTube at certain times for the setup.
Does the hosts file block YouTube on my iPhone?
No. The hosts file only affects the Mac you edited. To block YouTube on an iPhone or iPad, use Screen Time on that device or block it at the router or DNS level.
Does Screen Time work in private browsing?
Yes, for Safari. Screen Time restrictions are applied by the system rather than the browser window, so a private window doesn't get around them. The same isn't true for Chrome, which ignores the restriction entirely.
Can I block YouTube on a Mac without admin rights?
A browser extension usually installs per user and doesn't need an administrator password. Screen Time and the hosts file both require admin access, so they aren't options on a locked-down work or school Mac.
How do I unblock YouTube after editing the hosts file?
Restore the backup you made at the start with sudo cp /etc/hosts.backup /etc/hosts, then flush the DNS cache again. If you didn't make a backup, open the file and delete the YouTube lines.
Block the tab before it becomes an hour
Blocking YouTube on a Mac isn't difficult. The difficult part is choosing a method you won't undo the moment you're bored. Start with the browser you actually use: if it's Chrome or Firefox, install Obserra and set a limit or a work-hours block. If it's Safari, use Screen Time with a passcode. If you need it gone everywhere, edit the hosts file and keep the backup somewhere you won't reach for it impulsively.
Create a free Obserra account, install the extension in your Mac browser, and set your first limit. It takes about five minutes, and unlike the hosts file, you can adjust it when your schedule changes.