This article will teach you how to block specific websites on an iPhone and Mac. You can do this through the "Restrictions" menu on the iPhone, but on the Mac you will need to edit the "hosts" file.
Steps
Method 1 of 2: iPhone
Step 1. Open the "Settings" application
on the iPhone.
To do this, look for and open the gray gear icon located on the home screen.
Step 2. Scroll down and tap "General"
This option is at the top of the third main group of options, near the top of the "Settings" page.
Step 3. Scroll down and tap Restrictions in the middle of the page
Step 4. Enter the access code for the "Restrictions" function
This is the code defined when enabling the "Restrictions" function; it doesn't necessarily have to be the same as the regular iPhone passcode.
If you haven't enabled it yet, tap Enable Restrictions and enter the desired password twice.
Step 5. Scroll down to the "Allowed content" section and tap Websites
Step 6. Tap Limit adult content at the top of the page
Then a check mark will appear on the left side, indicating that this feature has been enabled.
Step 7. Tap Add a website
Do this in the "Never allow" section (not the "Always allow" section).
Step 8. Enter the website URL
This should be the full address of the website you want to block (such as "www.site.com" instead of "site.com").
Step 9. Tap Done
This blue button is located in the lower right corner of the keyboard. Doing so will block the specific website in Safari.
Method 2 of 2: Computer
Step 1. Open "Spotlight"
by clicking on the magnifying glass icon in the upper right corner of the screen.
Step 2. Enter terminal in "Spotlight"
Doing so will search for the "Terminal" application on the Mac.
Step 3. Click on
"Terminal".
It should appear at the top of the result below the search bar.
Step 4. Type
sudo nano /etc/hosts
and press the key ⏎ Return.
Doing so will execute a command to open the "hosts" file, responsible for controlling the websites accessible in all internet browsers, including Safari.
Step 5. Enter the Mac administrator password and press the ⏎ Return key
This is the password you use to access your Mac. When you enter it, it won't appear on your screen.
Step 6. Wait until the "hosts" file is opened
This process takes just a few seconds. It will then open in a new window, allowing you to edit it.
Step 7. Scroll down to the end of the file and press the ⏎ Return key
Use the directional arrow ↓ to navigate to the end of the file. Pressing the ⏎ Return key creates a new line.
Step 8. Type
127.0.0.1
and press the key Tab ↹.
That way, there will be some spaces between 127.0.0.1 and the next text.
Step 9. Enter the URL of the website you want to block This address usually consists of www
the website name (such as Google) and the final part such as.com,.net or.org.
- At the end the line should look something like this: 127.0.0.1 www.facebook.com.
- If you want to block multiple sites, each one must have its own line.
Step 10. Save the file and exit editor
After entering all the sites you want, press Control+O to save, then ⏎ Return. To exit the "hosts" file, press Control+X.
Step 11. Clear DNS cache
For the new settings to take effect, the DNS cache must be cleared. To do so, type
sudo killall -HUP mDNSResponder;say DNS cache has been flushed
and pressing the ⏎ Return key.