block-facebook
v1.0.10
Published
Keep Facebook from tracking your data.
Downloads
6
Maintainers
Readme
Block Facebook
A utility that applies the method described in this Quartz article, to keep Facebook from tracking your data.
This program is intended to block all sites that Facebook uses for data tracking, including facebook.com
, instagram.com
and whatsapp.com
. The cost of doing this is that you will be unable to access these sites, as well as all the other sites included on the block list, on the machine that has installed this program.
You can try it out for a while, and if you change your mind, follow the instructions in the Reverse Process section. Personally, I don't really use any of the Facebook social media offerings on my computer, so losing access to them isn't a big deal.
Compatibility
- Tested on MacOS.
- Not yet tested on Linux, but theoretically it should work, because the filesystem and commands are the same in the context of this program.
- Does not work on Windows.
- Note that this program accesses the
/etc/hosts
file, which is a root file. You will need the following:- Administrator and/or
sudo
access on your machine. - Vim editor (this is usually already preinstalled in MacOS and Linux).
- Administrator and/or
Install and Run
At any point, if prompted to enter password, enter the password you use to log in to your account on your computer.
Using npm
$ npm i block-facebook
$ cd ./node_modules/block-facebook
$ node index.js
Using git clone
$ git clone https://github.com/elainechan/block-facebook.git
$ cd block-facebook
$ sudo sh block-facebook.sh
Reverse Process
If you change your mind about blocking Facebook, use the Vim text editor to remove the domains that had been added to /etc/hosts
:
- Type the following in a shell.
$ sudo vim /etc/hosts
- If prompted for a password, enter the password you use to log in to your user account on your computer.
- Use the arrow keys to navigate to the line that says
0.0.0.0 apps.facebook.com
. - Press the
esc
key to ensure you're in the right mode. - Type
dG
to delete all the domains added byblock-facebook
. - Type
:wq
to save and quit. - Done.
How block-facebook
Works
When you run the block-facebook.sh
script, it opens the /etc/hosts
file in your root directory, inserts all the domains from the block list, and assigns 0.0.0.0
to those domains.
0.0.0.0
is intended to set the IP address as null
or empty. When your computer then tries to connect to one of the domains assigned this empty IP address, it won't be able to establish a connection. Since a connection cannot be established, you will not be able to access that site, and Facebook will not be able to access your data.
You can learn more about the meaning of the 0.0.0.0
IP address from this Stack Overflow question.
To learn more about /etc/hosts
, see this Ask Ubuntu question.