Uninstalling The Distillery
Important: If you added
export ANTHROPIC_BASE_URL=http://127.0.0.1:3080to a shell profile (.zshrc,.bashrc,$PROFILE, or similar), you must remove that line before you finish. Once The Distillery is gone, the port is dead. Claude Code readsANTHROPIC_BASE_URLon every startup; if it still points at127.0.0.1:3080, every request will fail with a connection error until you edit the profile and restart your shell. This is the single most common "why is Claude Code broken after I uninstalled?" problem.
The rest of this guide walks you through the full teardown in the right order: save data, stop the proxy, clear the hook entries, remove the package, delete the data directory, and scrub the shell profile.
What The Distillery actually installs
Understanding what got created makes the teardown easier to verify.
Global npm binary. npm install -g thedistillery creates a thedistillery shim in your npm global bin directory. npm uninstall -g removes it, but nothing else.
Data directory ~/.distillery/. Created lazily the first time the proxy runs. It contains:
data.db: SQLite database (WAL mode) with your session log, token counts, and cost savingsdata.db-walanddata.db-shm: SQLite WAL sidecar files (auto-created, safe to delete)config.json: persisted config including your API token, preset, and port settingsfile-cache.json: file-read dedup cache used by the PreToolUse hook
config.json contains an auth token. Run thedistillery auth logout before deleting the directory; this revokes the token server-side and zeroes out the local copy.
Project config files .distilleryrc.json. These are plain JSON files you (or the CLI) may have created in individual project directories. They have no secrets. There is no central registry of where they live, so the teardown guide includes a search command.
Claude Code hook entries in ~/.claude/settings.json. When you first run thedistillery start, it auto-edits ~/.claude/settings.json to add two hooks: a Stop hook and a PreToolUse (Read matcher) hook. Both point at shell scripts inside the installed package. npm uninstall -g deletes those scripts but leaves the JSON entries. Claude Code will throw an error on every Stop and PreToolUse event until you manually remove them.
The uninstall sequence
Step 1: Save your savings history (optional)
If you want to keep a record of your token and cost savings before wiping the database:
thedistillery export --format json --output ~/distillery-history.json
# or just print totals to stdout:
thedistillery stats
Step 2: Stop the proxy
thedistillery stop
If the daemon is already stopped, this prints "The Distillery proxy is not running" and exits cleanly. That is fine. If thedistillery stop fails for any reason, use the fallback:
macOS / Linux:
lsof -ti :3080 | xargs kill
Windows PowerShell:
Get-NetTCPConnection -LocalPort 3080 | Select-Object -ExpandProperty OwningProcess | Stop-Process
Step 3: Log out
thedistillery auth logout
This revokes the API token on the server side and removes it from config.json. If you skip this step and later delete the data directory directly, the token remains valid on the server until it expires.
Step 4: Remove Claude Code hook entries
Open ~/.claude/settings.json in a text editor. Find the hooks object and look for Stop and PreToolUse arrays. Delete any entry whose hooks[].command path contains any of these substrings: thedistillery, tokenslayer, cliptoken.
Example of an entry to delete:
{
"matcher": "Read",
"hooks": [
{
"type": "command",
"command": "/usr/local/lib/node_modules/thedistillery/dist/hooks/scripts/pretooluse-hook.sh"
}
]
}
After deleting matching entries, if an array is empty you can leave it as [] or remove the key; both are valid. Save the file.
On Windows, the settings file is at $HOME\.claude\settings.json (Claude Code uses os.homedir(), so the path is the same logical location).
Step 5: Uninstall the package
# npm
npm uninstall -g thedistillery
# pnpm
pnpm remove -g thedistillery
# Yarn classic
yarn global remove thedistillery
On Windows, npm can sometimes leave behind thedistillery.cmd and thedistillery.ps1 shim files if the uninstall is interrupted. Run where thedistillery after this step; if it still resolves, delete the leftover files manually from the npm global bin directory.
Step 6: Delete the data directory
macOS / Linux:
rm -rf ~/.distillery
Windows PowerShell:
Remove-Item -Recurse -Force $HOME\.distillery
Step 7: Scrub your shell profile
Open each profile file you use and remove any line that sets these variables:
ANTHROPIC_BASE_URLDISTILLERY_PORTDISTILLERY_BYPASS
And if you migrated from a legacy version (see Legacy name cleanup below):
TOKENSLAYER_PORT,TOKENSLAYER_BYPASSCLIPTOKEN_PORT,CLIPTOKEN_BYPASS
Profile files to check:
- bash:
~/.bashrc,~/.bash_profile,~/.profile - zsh:
~/.zshrc - fish:
~/.config/fish/config.fish - Windows PowerShell:
$PROFILE(usuallyDocuments\PowerShell\Microsoft.PowerShell_profile.ps1)
To find matching lines quickly:
grep -rn 'ANTHROPIC_BASE_URL\|DISTILLERY_PORT\|DISTILLERY_BYPASS\|TOKENSLAYER\|CLIPTOKEN' \
~/.bashrc ~/.bash_profile ~/.zshrc ~/.profile \
~/.config/fish/config.fish 2>/dev/null
On Windows, if you set ANTHROPIC_BASE_URL as a persistent system or user environment variable via setx:
# Remove the user-level persistent env var
setx ANTHROPIC_BASE_URL ""
Or open System Properties → Environment Variables and delete it from there.
After editing any profile file, restart your shell (open a new terminal window) so the changes take effect.
Step 8: Remove per-project config files (optional)
.distilleryrc.json files are plain JSON with no secrets. They live wherever you created them. To find them all:
macOS / Linux:
find ~ -name '.distilleryrc.json' -o -name '.tokenslayerrc.json' 2>/dev/null
Windows PowerShell:
Get-ChildItem -Path $HOME -Recurse -Force -Include .distilleryrc.json,.tokenslayerrc.json -ErrorAction SilentlyContinue
Delete any files the search returns.
Legacy name cleanup
If you used The Distillery before v4.0 (when it was called TokenSlayer or cliptoken), you may have additional leftovers:
Hook entries: The hook installer matches command paths containing thedistillery, tokenslayer, or cliptoken. If your ~/.claude/settings.json still has entries from a pre-v4 install, they contain the old names; make sure to remove those too in Step 4.
Environment variables: TOKENSLAYER_PORT, TOKENSLAYER_BYPASS, CLIPTOKEN_PORT, and CLIPTOKEN_BYPASS are still recognized by the current CLI (with a deprecation warning) but serve no purpose after uninstall. Remove them from your shell profiles.
Config files: .tokenslayerrc.json is the legacy config filename; findProjectConfig() still walks up looking for it. The find and Get-ChildItem commands in Step 8 already include .tokenslayerrc.json, so it is covered.
Verification
Run these commands after completing the sequence. All three should return empty or "not found":
macOS / Linux:
which thedistillery # should print nothing
ls ~/.distillery # should print: No such file or directory
echo $ANTHROPIC_BASE_URL # should be empty
Windows PowerShell:
where thedistillery # should print nothing
Test-Path $HOME\.distillery # should return False
$env:ANTHROPIC_BASE_URL # should be empty or null
Reinstalling later
If you want The Distillery back:
npm install -g thedistillery
thedistillery start
The data directory and Claude Code hooks are recreated automatically on first start. You will need to re-authenticate with thedistillery auth login. Claude Code is automatically reconfigured via hooks on first start. Other tools (Cline, Goose, Aider, etc.) still require the ANTHROPIC_BASE_URL environment variable set to http://localhost:3080.