Why Does Claude Code Remote-Control Keep Disconnecting and How to Fix It?
Problem
Claude Code’s remote-control feature kept disconnecting on me. I’d be working from my phone, connected to my Mac at home, and suddenly the session would drop. No warning, no reconnect, just silence.
Here’s what I experienced:
Session connected... working... working... DISCONNECTEDReconnecting... failedReconnecting... failedSession expired. Please restart Claude Code.I tried everything. I reconnected manually. I restarted the app. I checked my WiFi. Nothing worked reliably. The disconnections happened at the worst times - in the middle of code reviews, during debugging sessions, right when I needed Claude the most.
When I searched for solutions, I found I wasn’t alone. On Reddit, FromAtoZen (55 points) said: “It sucks… always disconnecting. Tailscale is much more feature rich.” And se7eneyes (16 points) added: “Really wanted to use remote-control, but the inability to clear sessions remotely is a deal breaker.”
The Root Causes
I dug into the problem and found three main culprits:
1. Network Instability
When I switched from WiFi to cellular, or moved between networks, the connection dropped. Claude Code’s remote-control didn’t handle network transitions gracefully.
2. Permission Prompts Blocking Operations
detinho_ on Reddit (3 points) described this perfectly: “Still a bit buggy… from the phone there were no options nor signs of processing… arrived home to see a permission request.”
I’d trigger an operation from my phone, but macOS would show a permission prompt on my Mac at home. Since I wasn’t there to click “Allow,” the operation hung silently. The session would eventually time out and disconnect.
3. No Automatic Recovery
When the connection dropped, Claude Code didn’t automatically reconnect. I had to manually restart everything. This made remote-control essentially useless for real work.
Solution A: Configure launchd for Auto-Restart
The first fix I implemented was making Claude Code automatically restart when it crashes or disconnects. I used macOS launchd with KeepAlive settings.
Here’s my launchd plist file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>Label</key> <string>com.claude.code</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/claude</string> <string>code</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <dict> <key>SuccessfulExit</key> <false/> <key>Crashed</key> <true/> </dict> <key>StandardOutPath</key> <string>/tmp/claude-code.log</string> <key>StandardErrorPath</key> <string>/tmp/claude-code-error.log</string></dict></plist>I loaded it with:
# Load the launchd joblaunchctl load ~/Library/LaunchAgents/com.claude.code.plist
# Verify it's runninglaunchctl list | grep claude
# Check logs if something goes wrongtail -f /tmp/claude-code.logThe KeepAlive settings are crucial:
SuccessfulExit: false- Restart if Claude Code exits with an error codeCrashed: true- Restart if Claude Code crashes
With this configuration, when Claude Code disconnects, launchd automatically restarts it within seconds. I don’t have to manually intervene.
Solution B: Use Tailscale for Stable Networking
The second fix was solving the network transition problem. I installed Tailscale on both my Mac and my phone.
# Install Tailscale on macOSbrew install tailscale
# Start the servicesudo tailscale up
# Authenticate with your Tailscale account# Follow the URL provided to complete setupOn my phone, I installed the Tailscale app from the App Store and logged in with the same account.
Tailscale creates a virtual network that stays stable even when I switch between WiFi, cellular, and different networks. The IP address stays the same. Connections don’t drop during network transitions.
Here’s my connection flow now:
Phone (Tailscale) -> Stable VPN -> Mac (Tailscale) -> Claude CodeEven when I’m in my car on 5G, the connection remains stable. I’ve successfully used remote-control while parked outside a coffee shop.
Solution C: Pre-approve Permissions Before Leaving
The third fix was simple but important. Before I leave my computer, I pre-approve all the permissions that Claude Code might need.
System Preferences > Privacy & Security:
- Accessibility: Add Terminal (or your terminal app) and Claude Code
- Full Disk Access: Add Terminal if you need file system access
- Developer Tools: Allow Terminal to run developer tools
I also run a quick test session before leaving:
# Start a test sessionclaude code
# Trigger a few operations that might need permissions:# - Read a file# - Write a file# - Run a command
# Verify no permission prompts appear on screenIf any prompts appear, I approve them right then. This prevents silent hangs when I’m remote.
Common Mistakes to Avoid
I made several mistakes before I got this working reliably:
Mistake 1: Relying on WiFi alone
I thought my home WiFi was stable enough. It wasn’t. Every time my ISP did maintenance, or I hit a dead spot, the connection dropped.
# WRONG: Direct connection over WiFissh my-mac-local-ip:22 # Fails when WiFi hiccups
# RIGHT: Tailscale VPN connectionssh my-mac-tailscale-ip:22 # Survives network transitionsMistake 2: Ignoring permission prompts
I’d trigger an operation from my phone, see nothing happen, and assume it worked. Meanwhile, a permission prompt was waiting on my Mac at home.
# Check for pending prompts before leaving# Look at the menu bar for any approval dialogs# Open System Preferences > Privacy & Security > review all itemsMistake 3: Not using KeepAlive
I’d manually restart Claude Code after crashes. This became tedious fast.
<!-- WRONG: No auto-restart --><key>KeepAlive</key><false/>
<!-- RIGHT: Auto-restart on failure --><key>KeepAlive</key><dict> <key>SuccessfulExit</key> <false/></dict>Mistake 4: Expecting instant reconnection
I thought remote-control should reconnect instantly like Slack or Discord. It doesn’t. The launchd restart takes 5-10 seconds.
# Wait for the service to restart# Check logs to see when it's readytail -f /tmp/claude-code.log | grep "ready"My Complete Setup
Here’s what I use now for reliable remote-control:
# 1. Install and configure Tailscalebrew install tailscalesudo tailscale up
# 2. Create launchd jobmkdir -p ~/Library/LaunchAgentscat > ~/Library/LaunchAgents/com.claude.code.plist << 'EOF'<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>Label</key> <string>com.claude.code</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/claude</string> <string>code</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <dict> <key>SuccessfulExit</key> <false/> <key>Crashed</key> <true/> </dict> <key>StandardOutPath</key> <string>/tmp/claude-code.log</string> <key>StandardErrorPath</key> <string>/tmp/claude-code-error.log</string></dict></plist>EOF
# 3. Load the joblaunchctl load ~/Library/LaunchAgents/com.claude.code.plist
# 4. Pre-approve permissions (do this manually in System Preferences)# - Accessibility: Add Terminal# - Full Disk Access: Add Terminal (if needed)# - Developer Tools: Allow TerminalWhen I’m ready to work remotely:
# 1. Verify Tailscale is runningtailscale status
# 2. Verify launchd job is loadedlaunchctl list | grep claude
# 3. Test a few operations to pre-approve permissionsclaude code
# 4. Leave home with confidenceWhy This Matters
With this setup, I’ve gone from “remote-control is unusable” to “I can work from anywhere.” I’ve successfully:
- Used Claude Code from my car on 5G
- Worked from coffee shops with flaky WiFi
- Switched between WiFi and cellular mid-session
- Left operations running without worrying about disconnections
The key is accepting that remote-control needs infrastructure support. Launchd handles crashes. Tailscale handles network transitions. Pre-approved permissions handle macOS security.
Summary
In this post, I showed how to fix Claude Code remote-control disconnection issues. The key points are:
- Use launchd with KeepAlive - Auto-restart on crashes and errors
- Use Tailscale VPN - Stable networking across WiFi/cellular transitions
- Pre-approve permissions - Prevent silent hangs from security prompts
Before implementing these fixes, I couldn’t rely on remote-control. Now it works even when I’m in my car on cellular data. The combination of automatic restart handling and VPN stability transforms remote-control from a frustrating experiment into a reliable tool.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments