Pi-Hole is a black hole for Internet advertisements. I recently tested this software and I found it to be amazing. Earlier, I used AdGuard on my Mac but due to performance and privacy concerns I decided to look for another solution, and Pi-Hole seems to be very good for this role.
The only problem is that Pi-Hole does not run on Mac natively, you better want to run it on a Linux or Raspberry-Pi box. But apparently it is possible to run Pi-Hole on Mac using Docker technology. In my case, I installed Pi-Hole on my MacBook Pro as a local service, so it works regardles of the specific network I'm connected to.
Here are the steps on how to do it:
- first of all, you need to install Docker for Mac. Alas, the solution won't work without this
- next, open your terminal and execute this command:
docker pull pihole/pihol- this command will download a Pi-Hole docker container to your machine
- now you need to start the container passing some parameters into it:
docker run -d --name pihole -e ServerIP=127.0.0.1 -e WEBPASSWORD="blahblah" -e DNS1=220.127.116.11 -p 81:80 -p 53:53/tcp -p 53:53/udp pihole/pihole:latest- this commands starts the container: it will be listening on your local network interface (127.0.0.1), it will be using an upstream DNS server 18.104.22.168 (CloudFlare), the admin password will be set to blahblah, and the admin web UI interface will be available at port 81. You can change all these parameters if you need to.
- check that the docker container started and is running:
docker ps -a- this command shows list of running docker containers and you shouldn't see errors in the output
- so, this is the time you can configure your system to use the local-running Pi-Hole as your DNS server. Go to the Network Preferences, select the network connection, click on the "Advanced" button, go to the "DNS" tab, and put "127.0.0.1" in the "DNS servers" list removing all the rest.
The Pi-Hole admin web interface with this configuration will be available at http://pi.hole:81/admin/ (use the password you passed in the command above for the logging in).
Some additional commands:
docker ps -afor showing the list of the running containers
docker container stop <CONTAINER_ID>for stopping the Pi-Hole container (CONTAINER_ID should be taken from the docker ps command)
docker container start <CONTAINER_ID>for starting the stopped Pi-Hole container