[BUG] TUI rendering broken when launched via AppleScript do script in Terminal.app (regression in ~v2.1.74)

Resolved 💬 3 comments Opened Mar 12, 2026 by leifdejong Closed Apr 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code's TUI renders incorrectly when launched programmatically via Terminal.app's AppleScript do script command. The exact same command works perfectly when typed manually into the same terminal window.

Symptoms:

  • Background color bleed (red/magenta backgrounds extending beyond text boundaries, covering the entire terminal)
  • Box-drawing character artifacts (black rectangular glitches over UI elements)
  • Washed out or incorrect colors throughout the TUI

This is a regression — the identical do script launch mechanism worked correctly on v2.1.73 and broke on ~v2.1.74.

| Launch method | v2.1.73 | v2.1.74+ |
|---|---|---|
| Manual typing in Terminal.app | OK | OK |
| AppleScript do script in Terminal.app | OK | Broken |

Screenshots

Working (command pasted via clipboard + System Events, bypassing do script):

<img width="602" height="483" alt="Image" src="https://github.com/user-attachments/assets/391527af-887c-4b98-b045-48b439a9549d" />

Broken (launched via do script on v2.1.74 — green background bleed begins):

<img width="602" height="483" alt="Image" src="https://github.com/user-attachments/assets/4bf4969f-de31-4fe9-b58a-ca6aab915ef7" />

Broken (same session after more rendering):

<img width="602" height="483" alt="Image" src="https://github.com/user-attachments/assets/05001f51-c6ab-42ab-91b6-d242ded5634a" />

What Should Happen?

Claude Code should render identically regardless of whether the command was typed manually or executed via do script. Both methods result in the same shell environment and PTY.

Error Messages/Logs

None.

Steps to Reproduce

  1. Open Script Editor on macOS
  2. Run this AppleScript:
tell application "Terminal"
    do script "claude"
    activate
end tell
  1. Observe broken TUI rendering (color bleed, artifacts)
  2. Close that window, manually type claude in a new Terminal window
  3. Observe correct rendering

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.73

Claude Code Version

2.1.74

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

What Was Tried (did NOT fix the issue)

  • Setting COLORTERM=truecolor explicitly via env
  • Setting TERM=xterm-256color explicitly
  • Wrapping with script -q /dev/null for an intermediary PTY layer
  • Adding delays before/after do script to allow shell initialization
  • Various combinations of the above

None of these resolved the rendering issue. The only working approach is to avoid do script for command execution entirely.

Workaround

Use do script "" to open a blank shell window, then paste the command via clipboard + System Events keystroke simulation:

-- Copy command to clipboard first, then:
tell application "Terminal"
    do script ""
    activate
end tell
delay 0.5
tell application "System Events"
    tell process "Terminal"
        keystroke "v" using command down
    end tell
end tell
delay 0.1
tell application "System Events"
    tell process "Terminal"
        key code 36
    end tell
end tell

This works because the command enters the shell the same way manual typing does, bypassing whatever do script does differently that triggers the rendering bug.

This is not ideal — it requires clipboard manipulation (save/restore), Accessibility permissions for System Events, and is more fragile than the native do script command.

Hypothesis

do script likely executes the command in a subtly different way than interactive shell input — possibly related to how the PTY is initialized or how stdin is attached. The v2.1.74 changes (potentially the RTL text rendering fix) made the Ink/React TUI sensitive to this difference.

Environment

Claude Code: v2.1.74 (native installer, ~/.local/bin/claude)
Last working version: v2.1.73
macOS: 15.1 (Darwin 24.1.0)
Terminal: Terminal.app (default macOS terminal)
Shell: zsh with oh-my-zsh
Hardware: Apple Silicon

Related Issues

  • #17787 — DSR 6 cursor position response leak (\e[6n before raw mode)
  • #1341 — chalk background color bleed
  • #5910 — Terminal rendering issues
  • #29706 — Washed out colors

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗