[BUG] iTerm2: Cmd+Click on a TUI link opens two browser tabs — terminal and TUI each open it once (a split, not a duplicate click event)
What's Wrong?
In iTerm2, Cmd+Clicking any link rendered by Claude Code's fullscreen TUI opens two identical browser tabs.
This is the same symptom as #68568 (JetBrains) and warpdotdev/warp#13512 (Warp), but the mechanism appears to be different and iTerm2 is not covered by either. In those reports the terminal double-delivers a single click, and the TUI acts on both. Here each handler fires exactly once, but there are two handlers:
- iTerm2 natively handles Cmd+Click on an OSC 8 hyperlink and opens the target, and
- mouse reporting is enabled, so the same click is also reported to the TUI, which opens it as well.
Calling it a split rather than a duplicate matters for the fix: de-duplicating pointer events by time+coordinate (as proposed in #68568) would not help here, because only one event is delivered to the TUI.
What Should Happen?
One Cmd+Click opens one tab.
Since iTerm2 already opens OSC 8 hyperlinks natively, the TUI arguably should not also act on a click it can see the terminal will handle.
Steps to Reproduce
- macOS, iTerm2,
"tui": "fullscreen", no mouse-related env vars set. - Start
claudeand have it print a link — any of these three shapes reproduces it:
- a bare URL, e.g.
https://example.com/A - a markdown link whose visible text is a different URL:
[https://example.com/B-TEXT](https://example.com/B-TARGET) - a markdown link with non-URL visible text:
[CLICK-C](https://example.com/C-TARGET)
- Cmd+Click any of them.
- Two identical tabs open.
Control (this is the useful part): the same three link shapes emitted directly to the terminal via printf with raw OSC 8 escapes — outside Claude Code, same iTerm2 window, same Cmd+Click — open exactly one tab each. So iTerm2's link handling on its own is correct; the second open only appears when the TUI is running.
Ruled out during diagnosis:
- Browser-router apps (Finicky, Choosy, Velja, Bumpr) — none installed or running.
- A second Chrome install;
http/httpsLaunchServices handlers are normal. - Custom iTerm2
PointerActions— stock. - Custom iTerm2 smart-selection rules — none.
- iTerm2's URL-text detector — case C has no URL in its visible text and still duplicates.
- An OSC 8 target vs. visible-text collision — case B uses deliberately different URLs and still yields two identical tabs, not one of each.
Workaround
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 fixes it completely, and the trade is much better on iTerm2 than the equivalent workaround in #68568: because iTerm2 opens OSC 8 links natively, surrendering the TUI's click handling costs nothing for links. Cmd+Click still works, just once. Wheel scroll is retained; click/drag/hover on TUI elements is lost.
It also works when set via settings.json env — worth noting given #2939's history of FORCE_HYPERLINK being ignored there. Verified it reads back from the process environment.
Claude Code Version
2.1.239
Platform / Environment
- macOS (Darwin 24.6.0), Apple Silicon
- iTerm2 3.4.23 (note: 3.6.11 is current; not yet tested on 3.5+/3.6+, so this may already differ on newer iTerm2)
"tui": "fullscreen", profile hasMouse Reporting = 1
Is this a regression?
Unknown — I don't have a known-good earlier version to point to.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗