ccy.dev
/

gtmux / 指南guides / 从任意电脑接回会话 Attach to your Mac from any computer

Attach to your Mac from any computer

Your Mac at the office is running a pile of agents, but you’re at home, in another room, in front of a different laptop. The phone can watch and reply, but sometimes you want a real terminal — the session, as-is, to keep working in. That’s what gtmux attach is for.

1 · Open a door on your Mac

gtmux serve                # local network
gtmux tunnel               # + a public URL, from any network, no VPN

serve is enough on the same WiFi; across networks, add tunnel — it gives you an https://…ccy.dev address over an outbound tunnel, no port-forwarding, no VPN.

2 · Attach from the other computer

gtmux attach <host> %7            # owner: host + --token
gtmux attach 'https://host/#t=…'  # or a scoped guest link

It bridges that pane’s PTY straight to the terminal in front of you — the remote tmux, your ~/.tmux.conf, truecolor, all intact. An owner token gives full access; a guest link only reaches the panes you allowed.

3 · Leave cleanly when you’re done

Press tmux’s prefix + d (default Ctrl-b d) or Ctrl-] to detach — the session keeps running on your Mac, untouched. The one thing to remember: don’t type exit in the pane; that closes the shell, it doesn’t detach.


Next: if you just want to watch and reply, the phone is smoother — install the iOS app. Handing a session to a teammate for a bit? gtmux share a scoped, revocable link (see the docs).

从任意电脑接回会话

你在公司的 Mac 上跑着一堆 agent,人在异地另一台笔记本前。手机能看能回,但你想要的是一个真正的终端——原样接着那个会话干。gtmux attach 可以达成。

1 · 在你 Mac 上开一个口子

gtmux serve                # 局域网
gtmux tunnel               # + 一个公网地址,任意网络,不用 VPN

同一个 WiFi 下有 serve 就够;跨网用 tunnel,它给你一个出站隧道,不用开路由端口、不用 VPN。

2 · 从另一台电脑接进来

gtmux attach <host> %7            # owner:host + --token
gtmux attach 'https://host/#t=…'  # 或一条受限的 guest 链接

它把那个 pane 的 PTY 原样桥到你眼前的终端——远程的 tmux、你的 ~/.tmux.conf、真彩色,全照旧。owner 用 token 全权;guest 链接只能进你允许的 pane。

3 · 干完退出

按 tmux 的 前缀 + d(默认 Ctrl-b d)或 Ctrl-] 断开——会话在你 Mac 上继续跑,一点不受影响。记住:别在 pane 里敲 exit,那是关掉 shell,不是断开 attach。


接下来: 只想看状态 + 回一句,手机更顺手——装 iOS app。想把某个会话临时给同事?gtmux share 一个受限、可撤销的链接(见 文档)。