This is a quick way to block sites that cause distraction in workspace. I find it useful to stop myself from habitually checking websites at work.

1. Launch Terminal

2. Type the following to Terminal

sudo vim /etc/hosts

Type in your password when prompted.

3. Press i and you’ll be in editing mode.

At the bottom of the list, add lines in the following format:

4. Press ESC then : then type wq! to save and exit.

5. Lastly, flush cache by typing in the terminal:

sudo dscacheutil -flushcache

6. Now when you try to access Facebook, you should get this.

This method makes your computer look for the domains you listed (e.g., on your local machine instead of the web.

p.s. If you want to regain access, just follow to step 3 and delete the lines you added.