Pairing
pmux pair connects your host to the Pocketmux mobile app through a secure key exchange. This is a one-time setup per host-mobile pair.
:::info Prerequisites
- You must have run
pmux initfirst (see Initialization). - Install the Pocketmux mobile app on your phone — get it from the App Store (iOS) or Google Play (Android).
:::
Running pair
$ pmux pair
Contacting signaling server...
Scan this QR code with Pocketmux on your mobile device:
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █▀ █▀▄█ ▄▄▄▄▄ ████
████ █ █ █▄ ██▀█ █ █ ████
████ █▄▄▄█ █ ██▀██ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ █▄█▄▄▄▄▄▄▄████
████▄▄▀▄█▀▄ ▀ ▄ ▀█ █▄▄▀████
████▀▄ █▄▀▄▀█▀█▄ █▀█▀▀▄▀ ████
█████▄███▄▄█▀▄▄ ▀▄█ █▄██▀████
████ ▄▄▄▄▄ █▄█▀ ▄██▀ ▄▄▄▀████
████ █ █ █▀▄█▀▀▄██ ▄█▀▀████
████ █▄▄▄█ █▀▄█▄▄ ▄█▄█▄█▄████
████▄▄▄▄▄▄▄█▄███▄▄▄█▄██▄█████
█████████████████████████████
█████████████████████████████
Manual pairing code: ABC123-DEFG-HJKL-MNPQ-RSTU
Waiting for mobile device to complete pairing...
Paired successfully with device 'My iPhone'
The QR code encodes the pairing code, the host's ephemeral X25519 public key, the host device ID, the signaling server URL, and a one-time pairing secret in a pipe-delimited format (5 fields). The pairing secret never leaves the two devices: it is shown only in the terminal and read by the phone, and the signaling server never sees it.
Scanning the QR code
Open Pocketmux on your phone. On first launch the app takes you to the Pair Device screen after it creates your identity. Later, tap Pair New Host on the host list. Tap Scan QR Code and point your camera at the QR code displayed in the terminal. The app reads the pairing payload from the QR code and completes the key exchange automatically.
If the QR code points at a signaling server other than the default https://signal.pmux.io (see server.url), the app first shows a Custom Server prompt with that server's address. Pairing and connection signaling for this host will go through that server, so tap Continue only if you trust it. Cancel stops pairing.
Manual pairing code
If QR scanning is not practical — for example, during an SSH session, screen sharing, or in a small terminal window — you can type the 22-character pairing code instead. On the Pair Device screen, tap Enter Code Manually. Dashes are optional when typing. The code includes the one-time pairing secret, so it is as sensitive as the QR code. It expires after 5 minutes.
The manual code does not carry the server address, so the app always pairs it through the default signaling server. If you run your own signaling server, scan the QR code instead.
What happens during pairing
The host requires a valid pairMac. A pair_complete message with no pairMac is rejected exactly like one with a mismatched pairMac, so a signaling server cannot downgrade pairing to an unauthenticated exchange by stripping the field. Pairing with a mobile build that does not send a pairMac fails; update the app and pair again.
The signaling server commits the pairing only after the host accepts it. If the host rejects the attempt, or the attempt times out, the previous pairing (if any) stays in place and the previously paired phone is not notified. Each pmux pair code allows exactly one attempt: after a rejection, run pmux pair again for a new code.
Both devices independently derive the same shared secret from the X25519 key exchange, salted with the one-time pairing secret. The host stores it in its secret backend (the system keychain, or an encrypted file; see Secret storage), and the phone stores it in the iOS Keychain or Android Keystore. Every time the phone connects, both devices use it to prove their identity to each other (see Connect-time key possession proof). The signaling server facilitates the exchange but never learns the pairing secret or the shared secret.
Re-pairing
Each host pairs with exactly one mobile device. Running pmux pair when a device is already paired prompts for confirmation before replacing the existing pairing:
A device is already paired: My iPhone (paired 2026-02-28). Replace it? [y/N]
The previously paired mobile receives a device_unpaired notification. A single mobile device can pair with multiple hosts.
Verifying the pairing
Use pmux status to confirm the pairing:
$ pmux status
Version: 0.1.0-dev
Agent: running (PID 48210)
Sessions: 0
Paired device: My iPhone
Device ID: f9e8d7c6b5a4...
Paired: 2026-02-28
Troubleshooting
:::warning Common issues
- Timeout — The pairing code expires after 5 minutes. Ensure both devices have network connectivity and run
pmux pairagain. - Server unreachable — Verify network access. Check the configured server URL with
pmux config. - QR too small — Widen your terminal window or use the manual pairing code instead.
- Already paired — If you need to pair a different mobile device, run
pmux pairand confirm the replacement when prompted. - "The host rejected this pairing" — The host could not verify that the phone read this code (a mistyped manual code, or an outdated app). The code is used up after one attempt. Run
pmux pairagain, scan the new code, and update the app if it keeps happening. - "Pairing timed out" — The host did not answer in time. Check that the terminal running
pmux pairis still waiting, then runpmux pairagain. - "This QR code is from an older version of pmux" — Update pmux on your computer (
pmux update) and runpmux pairagain. - "Invalid QR code: invalid serverUrl" — The server address in the QR code is not a plain
scheme://host[:port]: the host may only contain letters, digits, dots, and hyphens, or be a bracketed IPv6 address. Fixserver.urlin your configuration and runpmux pairagain. - Manual code fails with a self-hosted server — Manual codes always pair through the default server. Scan the QR code instead.
- "refusing to pair over unencrypted http://" —
pmux pairsends the pairing codes only overhttps://, except to a server on localhost or a private network address. Fixserver.urlin your configuration.
:::
Next steps
Your host is now paired. Use pmux just like tmux — see the CLI Reference for all available commands.