Remote Mac
Attribution: Sourced from steipete/agent-scripts by Peter Steinberger.
Use when you need to run or check something on a remote Mac over Tailscale or SSH.
Discovery
- Start with
tailscale statusand pick the matching host. - If Tailscale is down or SSH times out, try LAN discovery:
dns-sd -B _ssh._tcp local
arp -a
- Try mDNS names such as
HOST.localwhen visible.
SSH Rules
Use non-interactive SSH by default:
ssh -o RequestTTY=no -o RemoteCommand=none HOST 'COMMAND'
For long-running or interactive remote work, use tmux on the remote host:
ssh HOST 'tmux new-session -d -s work "long-command"'
ssh HOST 'tmux attach -t work'
Login Shell for PATH
Use login shells on remote Macs so Homebrew and other tools are on PATH:
ssh -o RequestTTY=no -o RemoteCommand=none HOST 'zsh -lc "command"'
Service Health Check Pattern
# Check launchd service
ssh HOST 'launchctl list | grep service-name'
# Check process
ssh HOST 'pgrep -af "process-name"'
# Check port listener
ssh HOST 'lsof -nP -iTCP:8080 -sTCP:LISTEN'
# Check tmux sessions
ssh HOST 'tmux list-sessions'
Safety
- Do not assume host identity from a stale IP; verify hostname/user when possible.
- Do not print secrets from remote files or shells.
- If a host is unavailable after Tailscale + LAN fallback, say what was tried.
- Do not install/start/stop services unless explicitly asked.