https://github.com/bdcdo/open-turkey
Open-source, Linux-native website & app blocker (Cold Turkey alternative). CLI + systemd, 4 enforcement layers.
https://github.com/bdcdo/open-turkey
app-blocker cli cold-turkey-alternative digital-wellbeing distraction-blocker focus go golang iptables linux productivity screen-time self-control systemd website-blocker
Last synced: 22 days ago
JSON representation
Open-source, Linux-native website & app blocker (Cold Turkey alternative). CLI + systemd, 4 enforcement layers.
- Host: GitHub
- URL: https://github.com/bdcdo/open-turkey
- Owner: bdcdo
- License: mit
- Created: 2026-06-06T18:37:03.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2026-06-18T18:05:32.000Z (about 1 month ago)
- Last Synced: 2026-06-18T20:09:10.097Z (about 1 month ago)
- Topics: app-blocker, cli, cold-turkey-alternative, digital-wellbeing, distraction-blocker, focus, go, golang, iptables, linux, productivity, screen-time, self-control, systemd, website-blocker
- Language: Go
- Size: 74.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Open Turkey
A command-line productivity blocker for Linux, backed by a `systemd` service.
Open Turkey is an open-source, Linux-native alternative to [Cold Turkey](https://getcoldturkey.com/): it blocks distracting websites and applications and keeps them blocked, even against your own attempts to undo it on impulse. Where Cold Turkey is paid and centered on Windows/macOS, Open Turkey is free, built in Go, and designed around the way Linux actually enforces policy.
It organizes blocking into **blocks** — named groups of:
- **Sites** (domains, e.g. `youtube.com`)
- **Apps** (process names, e.g. `discord`, `telegram-desktop`)
When you **activate** a block, a daemon continuously ensures the blocking layers stay applied.
## How it works — 4 enforcement layers
Open Turkey doesn't rely on a single, easily-bypassed mechanism. Each active block is enforced on four independent layers, and a `systemd` daemon re-applies them every 5 seconds if anything is tampered with:
1. **`/etc/hosts`** — resolves blocked domains to `0.0.0.0` (affects every program, not just browsers).
2. **Firewall (iptables)** — blocks network connections to the blocked sites.
3. **Browser enterprise policies** — managed `URLBlocklist`/`WebsiteFilter` policies for Firefox, Chromium, Google Chrome and Brave. The user cannot disable these from inside the browser, not even in private/incognito mode.
4. **Process kill** — terminates blocked apps that are running (SIGKILL).
Because the hosts and firewall layers act below the browser, blocking works even for browsers installed via Snap or Flatpak (where the system-wide browser policy file may not be read).
## Installation
Prerequisites:
- Linux with `systemd`
- `iptables` available
- Go (to build), at `/usr/local/go/bin` or otherwise on your `PATH`
Recommended:
```bash
sudo ./install.sh
```
This:
- compiles the binary (`CGO_ENABLED=0`, pure-Go SQLite via `modernc.org/sqlite`)
- installs `open-turkey` (a wrapper) and `open-turkey-bin` (the real binary) into `/usr/local/bin`
- adds a rule in `/etc/sudoers.d/open-turkey` so it runs without a password prompt
- installs and starts the `systemd` service `open-turkey.service`
- creates the database at `/var/lib/open-turkey/open-turkey.db`
The installed program is independent of the source directory — once installed, you can remove the project folder and it keeps working.
## Concepts
- **Block**: a set of sites/apps you want to block together.
- **Active**: a block that is currently in effect (the system is enforcing it).
- **Lock (`--lock`)**: when enabled, prevents deactivation via `stop`. The only way to deactivate a locked block is `unlock`, which requires completing a typing challenge — deliberate friction to outlast an impulse.
## Commands
### 1) Create and configure a block
```bash
open-turkey block create social-media
open-turkey block add-site social-media instagram.com x.com facebook.com
open-turkey block add-app social-media discord telegram
```
Show details:
```bash
open-turkey block info social-media
```
List all blocks:
```bash
open-turkey block list
```
### 2) Activate / deactivate
Activate:
```bash
open-turkey start social-media
```
Activate with a lock:
```bash
open-turkey start social-media --lock
```
Show status:
```bash
open-turkey status
```
Deactivate (only if not locked):
```bash
open-turkey stop social-media
```
Unlock a locked block (this also **deactivates** it):
```bash
open-turkey unlock social-media
```
### 3) Editing a block's lists
Remove a domain from a block:
```bash
open-turkey block remove-site social-media instagram.com
```
Notes:
- If the block is **active**, Open Turkey re-applies the layers so the change takes effect immediately.
- If the block is **active and locked**, you **cannot** edit its sites/apps. Run `open-turkey unlock ` first (which deactivates it), make your changes, then activate again.
Remove an app (process) from a block:
```bash
open-turkey block remove-app social-media discord
```
Remove an entire block (must be inactive):
```bash
open-turkey block remove social-media
```
## Service (daemon) and logs
The daemon is managed by `systemd`:
```bash
systemctl status open-turkey
systemctl restart open-turkey
journalctl -u open-turkey -f
```
## Uninstall
```bash
sudo make uninstall
```
## License
MIT — see [LICENSE](LICENSE).