Skip to main content
Jason Finance
AI Startup

Can't Copy the Claude Code OAuth URL? SSH Shows Sent via OSC 52, but the Mac Clipboard Is Empty

Can't copy the Claude Code OAuth URL over SSH? Fullscreen mode sends it via OSC 52 and the terminal may drop it. Set tui to default and select it yourself.

On this page
  1. 1.Can’t copy the Claude Code OAuth URL: first work out which problem you have
  2. 2.Why it says Sent via OSC 52 but the clipboard is empty
  3. 3.The fix: set tui to default and switch back to the classic interface
  4. 3.1The simplest way: run /tui default inside Claude Code
  5. 3.2What I actually did: back up, then change only the tui field
  6. 3.3Restart Claude Code and log in again
  7. 4.Other options that don’t change settings
  8. 5.Can’t get back to localhost after authorizing: handle the callback separately
  9. 6.How to undo it
  10. 7.What to know before you change it
  11. FAQ

You SSH from the Mac Terminal into a Linux server, run Claude Code there, and use /mcp to log in to an MCP server that needs OAuth. Claude Code prints a very long authorization URL with Sent via OSC 52 underneath, but the Mac clipboard has nothing in it, and the URL wraps across several lines so you can’t select it with the mouse either. In October 2026 I got stuck on exactly this Claude Code OAuth URL copy problem while running Claude Code on an Oracle Cloud VM over SSH and logging in to the Supabase MCP (/mcp → Authenticate). The tui setting and the callback handling below don’t depend on which MCP it is; they apply to any MCP that logs in with OAuth.

The short answer: add "tui": "default" to ~/.claude/settings.json for the remote user that runs Claude Code, restart Claude Code, and the OAuth URL I couldn’t copy before copied normally. tui is a setting listed in the official documentation, and default switches back to the classic interface (running /tui default inside Claude Code writes the same setting). If the browser can’t get back to localhost after you authorize, that is a separate problem, handled by pasting the callback URL back in or by SSH port forwarding.

This post is a record of what I did in October 2026 on an Ubuntu server in Oracle Cloud, working over SSH from the macOS Terminal, plus notes from the official Claude Code documentation, the Claude Code changelog and the xterm and OpenSSH documentation (checked on October 14, 2026; Claude Code on that server was version 2.1.296 that day). That "tui": "default" fixes the copy problem is what I found by testing in my own environment; it isn’t guaranteed to work for every Claude Code version, terminal or SSH setup. The MCP names, users and ports in this post are examples. Don’t share your real authorization URL, callback URL, authorization code or tokens with anyone.

Can’t copy the Claude Code OAuth URL: first work out which problem you have

What I saw at the time looked roughly like this (URL shortened):

Authenticating with my-server...
If your browser doesn't open automatically, copy this URL manually
(Sent via OSC 52 · select the URL manually if paste fails)
https://example.com/oauth/authorize?...

There are actually two problems here. They often get mixed up, and they are fixed in completely different ways:

Where you’re stuck What you see What to fix
Copying the URL It shows Sent via OSC 52, but pasting on the Mac gives nothing; the URL spans several lines and won’t select The terminal interface and the clipboard; see the next two sections
The callback after authorizing The URL opened in the browser and you clicked approve, but the browser ends up unable to reach localhost:<port>/callback The network path for the OAuth callback; see the callback section later

I set up SSH port forwarding first, and the URL still wouldn’t copy. Port forwarding handles the network path for the callback; it doesn’t put anything in the clipboard.

Why it says Sent via OSC 52 but the clipboard is empty

OSC 52 is a terminal control sequence. According to the xterm control sequence specification, a program base64-encodes what it wants to copy and sends it to the terminal, which writes it to the clipboard; the terminal can also turn this feature off. In other words, the remote Claude Code is only responsible for “sending”. Whether the clipboard receives it depends on your local terminal.

The official Claude Code fullscreen documentation mentions several things that bear on this problem:

  • The fullscreen interface (fullscreen rendering) takes over the mouse, so the terminal’s usual “drag to select, then copy” is handled by Claude Code itself.
  • When running locally, Claude Code writes to the clipboard with a system tool (pbcopy on macOS); over SSH it switches to OSC 52.
  • Some terminals block OSC 52 by default. iTerm2, for example, only allows it after you turn on a setting.
  • When tui isn’t set, Claude Code decides which interface to use from a table of rules. For example, people who receive feature flags from Anthropic and first used Claude Code after May 6, 2026 get the fullscreen interface by default.

I couldn’t find any official statement from Apple on whether the macOS Terminal supports OSC 52. What I can be sure of is what I saw: the screen said it had been sent via OSC 52, but the Mac clipboard didn’t receive it. After switching back to the classic interface, selection went back to the terminal, and I could select and copy the URL directly. That cause and effect is my inference from the official documentation; the documentation doesn’t spell out this scenario.

The fix: set tui to default and switch back to the classic interface

The Claude Code settings reference describes tui as choosing how the terminal interface is drawn, with only two values. According to the Claude Code changelog, the /tui command and the tui setting were added in version 2.1.110.

Value of tui Meaning
"fullscreen" Fullscreen interface: no flicker, mouse support, selection handled by Claude Code
"default" Classic interface: the conversation stays in the terminal’s normal scrollback
Not set Claude Code chooses by itself according to the official rules

Do all of the following as the Linux user that actually runs Claude Code, not the admin account. If you switch users with sudo -iu, check with whoami first.

The simplest way: run /tui default inside Claude Code

According to the official documentation, /tui default switches back to the classic interface and writes the tui setting, and your conversation is kept. Running /tui with no argument shows which interface you are currently using.

What I actually did: back up, then change only the tui field

I edited the settings file directly. If ~/.claude/settings.json already holds other settings such as permissions, don’t overwrite the whole file. The snippet below only adds or updates tui, and makes a backup before changing anything:

python3 - <<'PY'
import json
import shutil
from datetime import datetime
from pathlib import Path

p = Path.home() / '.claude/settings.json'
p.parent.mkdir(parents=True, exist_ok=True)

data = json.loads(p.read_text()) if p.exists() else {}

if p.exists():
    backup = p.with_name(f'settings.json.bak-{datetime.now():%Y%m%d-%H%M%S}')
    shutil.copy2(p, backup)
    print('Backup:', backup)

data['tui'] = 'default'
p.write_text(json.dumps(data, indent=2, ensure_ascii=False) + '\n')
print('Updated:', p)
PY

Confirm the file is still valid JSON and read back the value of tui:

python3 -m json.tool ~/.claude/settings.json >/dev/null && \
python3 -c 'import json,pathlib; print(json.loads((pathlib.Path.home()/".claude/settings.json").read_text()).get("tui"))'

The expected output is default.

Restart Claude Code and log in again

In the running Claude Code session, type /exit, then run claude to start it again. Open /mcp, choose the server you want to log in to, press Authenticate so it generates a new authorization URL, and try copying again.

I only restarted Claude Code in the terminal. I didn’t restart the always-on systemd Remote Control service for this.

Other options that don’t change settings

The options below come from the official documentation or the tools’ own documentation. I haven’t tested every one of them:

Option Good for Source
Hold Fn while dragging to select in Terminal An occasional one-off when you want to keep the fullscreen interface Claude Code fullscreen documentation: holding this key hands selection to the terminal, and Cmd+C works (Option in iTerm2)
Start with CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 Using the classic interface for this one time only Claude Code settings reference: for a single session, this environment variable takes precedence over the tui setting
Switch to iTerm2 and allow programs to access the clipboard Getting OSC 52 to work properly Claude Code documentation: Settings → General → Selection → Applications in terminal may access clipboard; running /terminal-setup in iTerm2 turns it on for you
Run claude mcp login <name> in the shell Not dealing with it inside the /mcp screen Claude Code MCP documentation: when it detects no local browser (for example over SSH), it prints the authorization URL directly, and you paste the browser’s full redirect URL back in; connect with ssh -t, and --no-browser forces this flow

If you run Claude Code inside tmux, tmux also handles the clipboard control sequence. According to the tmux manual, when set-clipboard is off, tmux neither accepts nor forwards that sequence. But if the outer terminal doesn’t support OSC 52 in the first place, changing the tmux setting won’t help.

Can’t get back to localhost after authorizing: handle the callback separately

Once the URL is copied, opened in the browser on the Mac and approved, OAuth redirects the browser to http://localhost:<port>/callback. That localhost is the Mac itself, while Claude Code is waiting on the VM, so the browser may show a connection error.

The Claude Code MCP documentation says two things:

  • By default the callback port is a random available one; to fix it, use --callback-port when adding the server.
  • If the browser redirect fails, paste the full callback URL from the address bar into the URL field that Claude Code shows.

That time I also opened another terminal on the Mac and set up SSH forwarding for the port in the redirect_uri on screen, for example:

ssh -N -L 57038:127.0.0.1:57038 my-vm

57038 is only an example. The port may be different each time you log in, so go by the redirect_uri for that session; replace my-vm with the host name from your SSH config. According to the OpenSSH manual, -L forwards a local port to the remote side and -N means no remote command is run, so after you run this line it just sits there without showing a prompt. That is normal.

In the Claude Code URL field, paste the full callback URL from the browser’s address bar, and don’t press the copy shortcut inside the field.

How to undo it

There are two ways to change it back:

  • Run /tui fullscreen inside Claude Code to switch back to the fullscreen interface.
  • Remove the tui field from the settings file, keeping your other settings, and let Claude Code choose by itself:
python3 - <<'PY'
import json
from pathlib import Path
p = Path.home() / '.claude/settings.json'
data = json.loads(p.read_text())
data.pop('tui', None)
p.write_text(json.dumps(data, indent=2, ensure_ascii=False) + '\n')
print('Removed tui from', p)
PY

Restart Claude Code after the change, as before. You can also restore the whole file from the settings.json.bak-<date-time> backup made earlier.

What to know before you change it

  • This is a user-level setting: ~/.claude/settings.json affects every Claude Code session this Linux user starts from now on, not just the project in front of you. According to the official documentation, background sessions opened from agent view or claude attach always use the fullscreen interface and ignore tui.
  • It only changes the interface: tui has nothing to do with MCP authorization, permissions or which account you connect to. After logging in, and before any operation that writes data, still confirm which account and which project the MCP is actually connected to.
  • Don’t make authorization URLs public: don’t paste authorization URLs, callback URLs, authorization codes or tokens into chats, issues or screenshots.

For how the server is set up and how Remote Control runs as an always-on service, see Running Claude Code Remote Control on a Free Oracle Cloud Server. For other errors on the same server, see Remote Control exit code 1, systemctl –user No medium found and installing Claude Code on ARM64. If you’re new to Claude Code, start with Claude Code for beginners. The whole series is on the AI startup topic page.

FAQ

Claude Code says Sent via OSC 52, so why is my clipboard empty?

OSC 52 is a terminal clipboard control sequence. Your local terminal has to support and allow it before the content lands in the clipboard. The official Claude Code documentation says that over SSH, copying switches to OSC 52, and that some terminals block it by default. In my case, using the macOS Terminal over SSH, the screen said it had been sent, but the Mac clipboard was empty.

What is the tui setting in settings.json?

tui is a setting listed in the official Claude Code documentation. It chooses how the terminal interface is drawn: fullscreen is the fullscreen interface and default is the classic interface. Running /tui default or /tui fullscreen inside Claude Code writes this setting for you; the changelog says it was added in version 2.1.110.

Will setting tui to default always let me copy the OAuth URL?

There is no guarantee. This is what worked when I tested it in my own environment: after adding tui: default to the remote user's settings.json and restarting Claude Code, the OAuth URL I couldn't copy before copied normally. With a different Claude Code version, terminal or SSH setup, you will need to test it yourself.

What if the browser can't reach localhost after OAuth authorization?

That is a separate problem from copying the URL. The official documentation's approach is to paste the full callback URL from the browser's address bar back into the URL field that Claude Code shows. You can also open another terminal on the Mac and use ssh -L to forward the port in that session's redirect_uri to the VM. The port may change each time, so check the screen for that session.

Does this also work for the Supabase MCP?

Yes. I ran into this exact problem while logging in to the Supabase MCP (/mcp → Authenticate) over SSH on an Oracle Cloud VM. The tui setting and the callback handling don't depend on which MCP it is, so the same applies to other MCPs that log in with OAuth. tui only changes the interface: after logging in, and before any operation that writes data, still confirm which account and which project the MCP is actually connected to.

How do I go back to the fullscreen interface after changing tui?

Run /tui fullscreen inside Claude Code, or remove the tui field from settings.json while keeping your other settings, then restart Claude Code. Once the field is removed, Claude Code picks the interface itself according to the rules in the official documentation.

Related articles

About the author

Photo of Jason

Jason

Account Manager in Google Large Customer Sales and Columbia MBA admit, sharing the money tools and experience he actually uses.

Comments

Sign in with Google to comment. Your comment will not show your Google profile picture or name; it appears under a randomly generated nickname to protect your privacy.

By signing in you agree to this site's privacy policy.

  1. Loading comments…