~/adi
Remote controlling Claude Code

Claude Code amazed me at launch.
With Claude 4 release, it cosplays AGI for code & sysadmin tasks, and convinced me to give Anthropic $100/mo. There’s a lot of good advice about how to get the most out of it so I won’t cover that - this is about how to remote operate it.
Why
CC is my weird intern in a terminal, parked on my second screen.
I mostly keep an eye on it as it works, waiting to respond to permission prompt or steer when I see it going down the wrong path.
With a good plan (don’t outsource your thinking!), Claude.md
(don’t outsource your opinions!), it can chip away at a task for hours, but needs steering and approvals.
Headless mode is fine for simple/self-contained tasks, and I built a thing that lets it Whatsapp me for permission, but that doesn’t work for interactive mode.
I run CC until I hit rate limits, then take a break - it’s a good natural reset. During these 3-5 hour sessions, each time I go AFK I feel the impulse to rush back and unblock/steer CC. This is obviously unhealthy and unproductive, so I’d rather live my AFK life while CC makes progress, checking in from time to time.
How
I’m in the Apple ecosystem, so this is a Mac/iPhone guide, but should be easy to port to Android app + Unix OS.
Prerequisites:
- Sign up for Tailscale
On your phone:
- Download the Tailscale app and connect to the Tailnet.
- Install a shell app which supports Mosh, I use Blink.
- Generate an SSH key. Blink has a neat feature to generate it in the secure enclave.
On your mac:
- Install Tailscale.app and connect to the Tailnet. The standalone app is recommended.
- Copy the public key from your phone to your computer, and save it in
~/.ssh/authorized_keys
. Create the directory if not exists. - Set permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
- Enable Remote Login in System Preferences, restrict it to your user.
- Edit
/etc/ssh/sshd_config
(requires sudo) and upsert the following to replace password auth with SSH key:
PubkeyAuthentication yes
PasswordAuthentication no
- Restart the SSH service:
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
- Install tmux
- Add this to
~/.tmux.conf
to allow mouse scroll and set a large history buffer, very useful on mobile and with claude code.
set -g history-limit 1000000
set -g mouse on
- Start a tmux session:
tmux new-session -A -s <session_name>
On your phone:
- Test the connection:
ssh your_macos_user@mac_tailnet_machine_name
- Once connected, run
tmux attach -t <session_name>
Congratulations! Now your phone and mac are connected to the same shell session. You can run claude code here, and see and interact with it from both sessions.
This gets you working SSH/session sharing, but SSH connections are brittle to changing networks. Mosh fixes this.
On your mac:
- Install Mosh
- Run
mosh-server
- Accept the prompt to allow incoming connections
On your phone:
- Replace the
ssh
command withmosh
Mosh should stay connected forever, but if you want to exit without killing the tmux session, use ctrl-B D
instead of ctrl-D
.
If you do accidentally kill the shell with claude code, resume it with claude -c
.
It’s far from a good mobile UX, but it works. Enjoy! Don’t forget start a tmux session before you go AFK.
Why not Tailscale SSH?
This would be a lot easier, but Tailscale.app on macOS can’t be a Tailscale SSH server.
I got it working with the open-source go binary tailscaled
+ manually setting DNS, but reverted to the app and configuring SSH manually because:
tailscaled
runs outside userspace, and can’t be managed as a VPN in System Settings- no support taildrop support & can’t use exit nodes
- no auto updates
- the CLI warned it was unstable, and for experiments and testing only
- I didn’t feel like an experienced macOS system administrator
- I was comfortable setting up SSH manually, and the above setup is hardened.
- I was only exposing my Mac’s SSH server on the local network, not the public internet. Tailscale is still required to reach the Mac.
I also tried running tailscaled
and Tailscale.app together, and at one point had 2 different connections to the tailnet from the same machine, but it was brittle and they were sharing state.
I rely on tailscale for important work/personal stuff, so I didn’t want to go down a non-recommended path.
© 2025 Adi Mukherjee. Credits.