Chrome native host script hardcodes version path on every update
Problem
The Chrome native messaging host wrapper script at ~/.claude/chrome/chrome-native-host gets overwritten on every Claude Code update with a hardcoded version path:
#!/bin/sh
# Chrome native host wrapper script
# Generated by Claude Code - do not edit manually
exec "/Users/<user>/.local/share/claude/versions/2.1.77" --chrome-native-host
When Claude Code auto-updates and old version binaries are cleaned up, this script points to a nonexistent file. The native messaging host process dies, Chrome loses the extension connection, and Chrome eventually crashes (clean exit, no error logs — likely related to macOS Automatic Termination kicking in after the extension connection is lost).
Expected Behavior
The script should resolve to the latest installed version dynamically rather than hardcoding a specific version path. For example:
#!/bin/sh
LATEST=$(ls -v "$HOME/.local/share/claude/versions/" | grep -E '^[0-9]' | tail -1)
exec "$HOME/.local/share/claude/versions/$LATEST" --chrome-native-host
Current Workaround
We manually replace the hardcoded script with a dynamic version after each update, but it gets overwritten again on the next Claude Code update.
Environment
- macOS (Darwin 25.4.0, Apple Silicon)
- Claude Code 2.1.77
- Google Chrome 145.0.7632.160
Steps to Reproduce
- Install Claude Code and connect Chrome extension — script is generated with hardcoded version
- Wait for Claude Code auto-update (e.g., 2.1.76 → 2.1.77)
- Old version binary is cleaned up
- Chrome extension loses native host connection
- Chrome eventually exits cleanly (no crash report)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗