Skip to content

/copy command does not work on macOS Terminal.app (OSC 52 not supported) #15664

@unstoppablesssss

Description

@unstoppablesssss

Problem

On macOS Terminal.app, the /copy command silently fails to copy text to the clipboard.

The current implementation in _write_osc52_clipboard relies exclusively on the OSC 52 escape sequence. Terminal.app does not support OSC 52 (unlike iTerm2 or Warp), so the sequence is sent but has no effect — the user gets the success message but the clipboard is unchanged.

Steps to reproduce

  1. Open Hermes TUI in macOS Terminal.app (hermes)
  2. Ask anything, wait for a response
  3. Type /copy and press Enter
  4. Try to paste — clipboard is empty

Expected behavior

The last assistant response is copied to the clipboard.

Environment

  • macOS 15.x
  • Terminal.app (built-in, no iTerm2)
  • Hermes Agent v0.11.0
  • mouse_support=False is already set (not the cause)

Suggested fix

Add a native clipboard fallback after the OSC 52 attempt. On macOS, pbcopy is always available and requires no extra dependencies:

def _write_osc52_clipboard(self, text: str) -> None:
    # ... existing OSC 52 code ...

    # Fallback for terminals that don't support OSC 52 (e.g. Terminal.app)
    import subprocess as _sp
    import platform as _platform
    try:
        if _platform.system() == 'Darwin':
            _sp.run(['pbcopy'], input=text.encode('utf-8'), check=True, timeout=3)
        elif _platform.system() == 'Linux':
            # try xclip / xsel
            ...
    except Exception:
        pass  # OSC 52 already sent, native fallback failure is non-fatal

This is a two-line fix with zero new dependencies on macOS and gracefully degrades if pbcopy is somehow unavailable.

Workaround (for users hitting this now)

The fix can be applied locally to ~/.hermes/hermes-agent/cli.py until it lands upstream. Note that hermes update will overwrite the patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions