Block Facebook system-wide using the Hosts file
By editing the hosts file, you will block Facebook (or other specified websites) from all applications on that computer.
How to block Facebook with the Hosts file in Mac OS X:
This works in all versions of Mac OS X.
- Launch the Terminal, located in /Applications/Utilities/
- At the command line, type:
sudo open /etc/hosts
- Enter your administrative password when asked
- TextEdit will now launch with /etc/hosts open, you need to add the following lines to the bottom of the file:
- Each one of those entries must be on it’s own line. Save the file when it’s finished editing
- Now you need to flush the DNS cache for changes to take effect, type the following command in the Terminal:
- Try to access facebook and it should no longer work
If you remove the entires from the /etc/hosts file you will be able to access Facebook again as usual.
How to block Facebook with the Hosts file in Windows:
This works for Windows XP, Windows Vista, and Windows 7.
- Locate your Windows hosts file, at C:WINDOWSsystem32driversetchosts
- Open this file in your favorite text editor, Notepad works fine
- Add the following lines to the hosts file:
- Reboot your Windows PC and try to access Facebook, it should be blocked
You can then unblock Facebook by simply removing the entries from the hosts file.
Leave a Reply