A macOS CLI tool that blocks domains of your choice by editing /etc/hosts. Supports plain blocking and Pomodoro-style work/rest cycles.
Requires sudo because it modifies /etc/hosts and flushes the DNS cache.
git clone https://github.com/vaahoot/zen-mode.git zen
cd zen
make
Produces out/zen, you can move the executable to /usr/local/bin/.
brew tap vaahoot/tap
brew install zen-mode
zen -v
sudo zen -b reddit.com youtube.com # block until Ctrl-C
sudo zen -b youtube.com -w 25 -r 5 # 25 min work / 5 min rest cycle
sudo zen -u youtube.com # unblock a specific domain
sudo zen -U # unblock everything zen manages
Flags:
-b, --block— domains to block. Runs as a foreground process until interrupted; Ctrl-C unblocks and exits.-u, --unblock— domains to unblock.-U, --unblock-all— remove every entry zen added.-w, --work MINUTES— work phase duration (requires-r).-r, --rest MINUTES— rest phase duration (requires-w).-h, --help— show help.
Both the bare domain and its www. variant are blocked. Entries are tagged with a # ZEN_BLOCK marker so zen only touches its own lines.
Browsers cache DNS lookups internally and will keep resolving blocked domains until that cache is cleared. To make blocking take effect you must either:
- start zen before opening the browser, or
- restart the browser after starting zen.
The same applies after a rest phase ends and blocking resumes — if the browser stayed open through the rest window it may have cached the real IP, and will need to be restarted for the next work phase to block effectively.
- Zen appends
127.0.0.1 domain # ZEN_BLOCKentries to/etc/hoststo redirect those domains to localhost, then rewrites the file to remove them on unblock. - macOS's
osascriptis used to send notifications. - DNS cache is flushed via
dscacheutil -flushcacheandkillall -HUP mDNSResponderafter every hosts mutation.
MIT
I am aware that it's easy to get around it, the point of the app is to prevent unconscious doom scrolling sessions, not create an unbreakable wall.