Please read this whole message before doing anything.
This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
The purpose of this step is to determine whether the problem is localized to your user account.
Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up guest users” (without the quotes) in the search box. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
Test while logged in as Guest. Same problem?
After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
*Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
When you see the gray Apple logo, release the shift key.
If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs. The next normal boot may also be somewhat slow.
The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
*Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode.
Test while in safe mode. Same problem?
After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.
If the preference pane is locked, click the lock icon in the lower left corner and enter your password to unlock it. Then click the Advanced button and select the Proxies tab. If any proxy options are selected, deselect them. You don’t need to change the bypass or FTP settings. Click OK and then Apply. Test. The result may be that you can't connect to any web server, so be prepared to restore the previous settings if that happens.
You hacked the system to block ad servers. The file modified is /etc/hosts.
By far the easiest way to fix the hosts file is to restore it from a Time Machine (or other) backup that predates the modification. If that's not possible, then do as below. Please read this whole message before doing anything.
Back up all data.
If you have more than one user account, you must be logged in as an administrator to carry out these instructions.
Triple-click anywhere in the line below to select it:
Copy the selected text to the Clipboard (command-C).
Launch the Terminal application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
Paste (command-V) into the Terminal window. A TextEdit window should open. At the top of the window, you should see something like this:
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
Below that, you'll see some other lines. There should be nothing before the first line above. Make sure you scroll all the way to the bottom of the document. In OS X 10.7 or later, scroll bars are hidden by default until you actually start scrolling, so you may not realize that you’re not seeing the whole document.
If the contents of the TextEdit window are as described, close it, then enter the following command in the Terminal window in the same way as before:
sed '/lo0/q' !$ > Desktop/hosts
You should now have a file named "hosts" on your Desktop. Double-click the file to open it in TextEdit, and verify that it has only the contents shown above, with any extra lines removed. If so, close the window without making any changes.
Next, go back to the Terminal window and enter one final command, again without typing:
sudo sh -c 'cat Desktop/hosts > /etc/hosts'
This time, you'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. Confirm. Quit Terminal. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
That will fix the hosts file. You can now delete the file that was created on your Desktop.