[BUG] PostToolUse hooks not firing on Termux/Android while other hooks work
Environment
- Platform: Android (Termux)
- Claude Code Version: 2.0.76
- Node Version: v25.2.1
- Shell: /data/data/com.termux/files/usr/bin/bash
- OS: Linux 6.1.128-android14 aarch64
Description
PostToolUse hooks are not firing on Termux/Android, while all other hook types work correctly. The hook commands execute perfectly when run manually, confirming the issue is with the event emission, not the hook configuration or command syntax.
What Works ✅
| Hook Type | Status |
|-----------|--------|
| PreToolUse | Works |
| SessionStart | Works |
| Stop | Works |
| SubagentStop | Works |
| Manual hook execution | Works |
What Doesn't Work ❌
| Hook Type | Status |
|-----------|--------|
| PostToolUse (empty matcher) | Not firing |
| PostToolUse ("Bash" matcher) | Not firing |
| PostToolUse ("*" matcher) | Not firing |
Configuration
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "/data/data/com.termux/files/usr/bin/bash -c 'echo \"[$(date -Is)] PostToolUse:Bash fired\" >> /data/data/com.termux/files/home/.claude/posttool.log'"
}
]
}
]
Steps to Reproduce
- Install Claude Code on Termux/Android
- Configure PostToolUse hook in
~/.claude/settings.json - Start Claude Code session
- Execute any Bash command (e.g.,
echo "test") - Check log file - no entry created
Expected Behavior
PostToolUse hook should fire after each tool execution, writing to the log file.
Actual Behavior
- PostToolUse hook never fires
- Log file remains empty (unless manually triggered)
- PreToolUse with identical config pattern works fine
Manual Test Proof
# This works - command is valid
/data/data/com.termux/files/usr/bin/bash -c 'echo "[$(date -Is)] PostToolUse:Bash fired" >> ~/.claude/posttool.log'
# Log shows: [2025-12-28T20:18:22+00:00] PostToolUse:Bash fired
# But when Claude Code runs Bash tool, PostToolUse never triggers
Analysis
The issue appears to be that Claude Code's internal event emitter for PostToolUse is not triggering on Termux/Android. The hook registration works (other hooks fire), but the specific PostToolUse event dispatch after tool completion doesn't happen.
This may be related to:
- Android process spawning differences
- Node.js event loop behavior on Android
- Termux-specific environment handling
Related Issues
- #6403 - PostToolUse Hooks Completely Non-Functional (macOS)
- #6305 - Post/PreToolUse Hooks Not Executing
- #3179 - PreToolUse and PostToolUse not triggering on WSL2
Additional Context
User reports PostToolUse works on other systems (macOS, standard Linux), making this a Termux/Android-specific regression or compatibility issue.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗