Blocking specific sites

Discussion in 'Mac Basics and Help' started by mavericks7913, Jun 10, 2016.

  1. mavericks7913 macrumors 6502

    Joined:
    May 17, 2014
    Location:
    NY
    #1
    Hi I would like to block specific sites in order to not to get distractions from. If I want to block all sites relate to youtube, how can I block the site?
     
  2. JohnDS macrumors 65816

    Joined:
    Oct 25, 2015
    #2
    You can block specific sites by modifying the Mac's /etc/hosts file.

    The easiest way to do that is to download a copy of the free TextWrangler:

    http://www.barebones.com/products/textwrangler/download.html

    Once you have done that and installed TextWrangler, click on the desktop to make sure you are in Finder. Then pull down the GO menu to Go To Folder. Copy and past the following line into the Go To Folder box and hit return:

    /etc

    This will open up a Finder window with the hidden /etc folder.

    Look for a file called "hosts". Right-click on it and choose "Open With" and choose "Other", then "Text Wrangler". This should open the file in TextWrangler.

    Your default hosts file should look like this:

    ##
    # Host Database
    #
    #
    # localhost is used to configure the lookback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost
    255.255.255.255 broadcasthost


    ::1 localhost
    fe80::1%lo0 localhost
    You can then block any URL by adding some lines follow the line "255.255.255.255 broadcast host"

    For instance, if you wanted to block YouTube, Facebook, you would add the lines:

    0.0.0.0 youtube.com
    0.0.0.0 facebook.com

    so your hosts file would then look like:


    ##
    # Host Database
    #
    #
    # localhost is used to configure the lookback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost
    255.255.255.255 broadcast host
    0.0.0.0 youtube.com
    0.0.0.0 facebook.com


    ::1 localhost
    fe80::1%lo0 localhost
    In other words, adding a line with 0.0.0.0 followed by the URL you want to block will block that URL.

    Once you have done that, save the file and reboot your computer. You should find that you can no longer access the blocked URLS.

    This can also be used to block ad sites like doubleclick.com
     

Share This Page