How to block websites and apps on your Mac

266.1K views
9 min read

Even though Apple offers built-in filters for web content that can be accessible on your Mac (Screen Time’s parental controls), sometimes they might feel somewhat of a “blanket coverage.” If you prefer a more targeted approach, there are other ways to have your Mac block access to websites. 

In this article, you’ll learn how to activate Screen Time web content restrictions, how to block websites on Safari Mac without parental controls, how to block access to a specific app or section of a website, and how to create a personalized block list of URLs you’d like to make inaccessible on your Mac.

If you’re asking yourself, “Can I block a website on Safari?” the answer is a definite yes.

Reasons for blocking websites on Mac

The most common reasons for trying to figure out how to block access to a website on Mac are personal productivity and the safety of online environment for children.

We all know how addictive a new app or a favorite social media account can be, turning the time we spend on Mac into hours of fruitless activity. If you have kids, this also adds a concern about the risk of running into inappropriate adult content online.

Luckily, there are different ways you can take back control and limit which sites can be reached from your Mac, learning how to block a website on Safari, Chrome, and other browsers.

The easiest way to block websites on Mac

If your main reason for Mac block access to websites is getting rid of distractions while you’re trying to focus on your work, the smartest way to do it is to let your macOS block websites for a specified period of time or according to a schedule that fits your work and leisure times.

This way you wouldn’t have to go through all the steps to block or unblock internet resources, social media, or apps every time you decide to concentrate on a task or feel the need to unwind. Simply come up with a list of sites that tend to eat up your time the most, set goals for how long you’d like to work, and install Focus.

Focus knows how to block websites on Mac for as long or as short as you want: you can set a regular schedule with blocking times for workdays and weekends or use one-off custom focus streaks whenever you need to dive into something. 

Here’s how to block access to a website on Mac using Focus:

  1. Install Focus and click on its icon in the menu bar ➙ Preferences.
  2. Go to the Blocking tab ➙ Websites.
  3. Customize the list of websites you don’t want to see while working: use the plus button at the bottom of the window to add websites and the minus button to remove sites from the list.
  4. Click on the Applications tab and add applications you’d like to block.

    block websites with Focus app

Now when you activate the focus mode from the app’s menu bar icon and try to visit a blocked site or application, all you’ll see will be a blank screen with a quote to keep you motivated.

How to block websites in Safari on Mac using Screen Time

Using macOS built-in Screen Time content restrictions can become a good solution to the “how to block a website on Safari or other browsers on Mac?” question. 

To block access to a website on Mac with Screen Time:

  1. Open System Settings from the Apple menu.
  2. Click on Screen Time in the sidebar and make sure it’s turned on.
  3. Go to Content & Privacy ➙ Web Content.
  4. Choose Limit Adult Websites and click on Customize.
  5. Click on the plus button in the Restricted section to add a site you'd like to block ➙ OK.

    Screen Time's content and privacy restrictions

If customizing your workflows on Mac to perfectly suit your needs appeals to you, make sure you try OpenIn.

OpenIn helps you set default browsers and apps for opening different types of links. For example, set it to always open Zoom links in the Zoom app or send calendar links to Google Meets even if your main browser is Safari. Using multiple browsers for different tasks and appointing specific mail clients for your email could become a real lifesaver if you like to keep your work, study, and personal files separate. 

optimize productivity with OpenIn

Additionally, OpenIn lets you create defaults for all types of files you open on Mac so that you could save time by improving your daily routines.

How to block websites in Safari on Mac with Terminal

Another way to have your macOS block websites in Safari (or any other browser) is to modify your Mac’s hosts file in Terminal.

The hosts file is a macOS file that helps web browsers connect domain names to their corresponding IP addresses. It’s possible to edit this file in a way that certain website names won’t connect to their IP and thus will be effectively blocked on your Mac.

Here’s how to block a website on Safari with Terminal:

  1. Open Terminal from Finder (Finder ➙ Go ➙ Utilities).
  2. Type sudo nano /etc/hosts and press Enter to open the hosts file.
  3. Find the line that reads 127.0.0.1 localhost and use the arrow keys on your keyboard to cursor down to the line just below it.
  4. Hit Enter to create a new line.
  5. Type 127.0.0.1, hit the tab key to create a space, and enter the URL of the website you’d like to block.
  6. Repeat steps 4 and 5 to add more websites.
  7. Press Control + O to save the changes you’ve made to the Hosts file.
  8. Press Control + X to close the file.

    block websites in Terminal

For the block to become effective immediately, make sure to flush the DNS cache: type in the Terminal window and press Enter.

If you’re a heavy Terminal user and regularly manage multiple SSH accounts, be sure to try an improved version of Mac Terminal, called Core Shell. 

Core Shell is fully compatible with Apple’s native SSH, offers advanced features, and helps to keep all SSH accounts organized with custom tags for hosts:

  • Access pro options, like proxy jump or agent forwarding, with built-in OpenSSH support. 
  • Edit settings across different hosts.
  • Enjoy secure integration with Keychain, one-click login, and automatic reconnect.
  • Choose from nine different color schemes (how does Dracula, Solarized, or Homebrew sound?). 
  • Organize and instantly locate any of your hosts by their assigned tags.

    Core Shell - new SSH

How to block websites on macOS via router

Adjusting the settings of your WiFi router is another way to have your Mac block access to websites you’d like to avoid. Just remember that this block will be valid not only for your Mac but also for all other devices using your wireless network.

Here’s how to block websites on Safari Mac without parental controls using your router settings:

  1. Find your router’s IP address in System Settings on your Mac (System Settings ➙ Network ➙ WiFi ➙ Details ➙ TCP/IP).
  2. Copy the router's IP address and paste it into your browser's address bar ➙ Enter.
  3. Enter the admin name and password for your router when requested (if you’ve never reset those, check the sticker on your router or try “admin” and “password”).
  4. Browse router settings for options that allow blocking sites (the specifics will vary depending on the model of your router).
  5. Add URLs for websites you’d like to block.

While you’re thinking about how to block websites on Mac, we suggest you also take care of intrusive browser ads and online tracking with AdLock.

AdLock allows you to set rules for the types of commercial content you’d like to avoid (think online chats, notifications, pop-up ads, autoplay videos, and so on) and protects your browsing against trackers, scammers, phishing, and malware.

AdLock browsers filters

How to have your Mac block access to websites

When you learn how to block access to a website on Mac it’s easy to regain control over your productivity or make sure your kids have access only to the web content you approve of.

Compile a list of websites you’d like to become unreachable from your Mac and block them in the hosts file with Terminal or in your router’s settings. Or use built-in parental control options in Screen Time to automatically filter any website’s content in addition to the customized “blocked” and “approved lists.”

If you’re interested in how to block websites on Safari Mac without parental controls, try Focus — you’ll be able to instantly switch off any distracting websites and apps with a click on a menu bar icon. Consider AdLock to grant yourself additional protection from unwanted browser pop-ups and tracking.

How to block websites or apps for focused work

If you want to block a website or an app to prevent yourself from wandering off from your task, Focused Work is the tool for you.

The app helps you work in timed focus sessions and one of its key features is blocking distracting websites and apps.

To add an item to the block list, open the app and click Focused Work in the left side of your menu bar. Go to Settings… > App & Website Blocking. In the pop-up window, click Create Blocklist and proceed to add the items you want to block.

Focused Work's Blocking behavior settings

You can create multiple blocklists to use during different focusing sessions. This can be very helpful if your timed sessions involve varying tasks and you need to block different sets of apps and websites for each.

Don’t pass on a chance to test Focus, Focused Work, AdLock, OpenIn, and Core Shell for free with the seven-day trial of Setapp, a platform of best-in-class iOS and macOS productivity apps. Learn how to block websites on Mac and check out more than 240 other options to boost your productivity.

FAQ

Can I permanently block a website in Safari?

An easy answer to the “Can I block a website on Safari?” question is yes. You can add the website’s URL to the blocking list in Screen Time, macOS hosts file, or in the settings on your WiFi router. On the other hand, you can also remove any website you’d like to return to from the list at any time. So the block is permanent — but only until you decide you’d like to have it lifted.

How do I block YouTube in Safari?

You can have your macOS block websites like YouTube by configuring Screen Time’s Content & Privacy settings (System Settings ➙ Screen Time ➙ Content & Privacy ➙ Web Content ➙ Limit Adult Websites ➙ Customize). You can also add www.youtube.com to the blocking list in your router’s settings or use Terminal to add a block to the hosts file IP mapping.

How do I block a website in Chrome on Mac?

The easiest way to block any website in Chrome on Mac is with Focus. Simply add the website’s URL (you can also block sections of a website or even separate pages) to the list of websites and apps you wish to become inaccessible and set the timer to easily shut your distractions off. Everything will return to business as usual when your focus session is over. (Or keep the sites blocked round the clock if you need to.)

250+ apps for $9.99
per month

Sign up to Setapp and try them for free.

Security-tested