SXAccessSXAccessDocs
Open dashboard

Install on macOS

The CLI on a Mac: one script, a system service, and everything a Mac nobody sits at needs.

shell - install
curl -fsSL https://pkgs.sxaccess.com/install.sh | sh

The same script that installs the CLI on a Linux server installs it on a Mac, Apple silicon or Intel, as /usr/local/bin/sxaccess. It registers the agent as a LaunchDaemon and starts it, so launchd runs the agent from boot, whether or not anyone is logged in. The script needs root rights and asks for your password through sudo, so run it on its own and wait until it has finished. Running it again replaces the installed version in place, which is how you upgrade; the installer options are the same as on Linux.

Then connect the Mac: sxaccess start opens your browser so you can sign in. A Mac nobody signs in at enrols with a key instead, see A Mac with nobody at it. For a Mac someone works at every day, the SXAccess app is the simpler choice.

shell - connect
sxaccess start

Where things live

PathContents
/usr/local/bin/sxaccessThe CLI and the agent, one binary
/Library/LaunchDaemons/sxaccess.plistThe LaunchDaemon that runs the agent
/var/run/sxaccess.sockThe socket the CLI uses to talk to the agent
/var/lib/sxaccess/What the agent keeps. default.json is this Mac's identity: its keys and settings. state.json records the system changes the agent made, so it can undo them. A folder per local user holds the identities added by sxaccess identity add and the enrolments in other organizations
~/Library/Application Support/sxaccess/Per user: which identity the CLI uses, and the email each identity signed in with
/var/log/sxaccess/client.logThe agent's log
/var/log/sxaccess.out.log, /var/log/sxaccess.err.logWhat launchd captures from the agent's standard output and error
utun217The tunnel interface the agent creates
UDP 51820The port the tunnel listens on. If it is taken, the agent picks another one

Managing the service

launchd runs the agent, so the systemctl commands you may know from Linux do not apply. The agent commands manage it instead; they need sudo, except agent info, which prints Agent service: Running while the agent runs.

shell - is the agent running?
sxaccess agent info
shell - restart the agent
sudo sxaccess agent restart
shell - stop the agent
sudo sxaccess agent stop
shell - start the agent
sudo sxaccess agent start
shell - follow the agent's log
sudo tail -f /var/log/sxaccess/client.log

sxaccess start and sxaccess stop connect and disconnect the Mac without touching the service.

shell - connect, then show the details
sxaccess start && sxaccess info -d
shell - disconnect
sxaccess stop

A Mac with nobody at it

There is no browser to open on a Mac nobody signs in at, so enrol it with an enrollment key. A device enrolled with a key has no owner and its session never expires. Pass the key with --enrollment-key for a one-off, or point --enrollment-key-file at a file when the key comes from a secret store: the file keeps the key out of ps and out of your shell history. The sxaccess command reads the file itself, so keep it readable by the account that runs the command and by nobody else. SX_ENROLLMENT_KEY works as well, as on Linux.

shell - enrol with a key
sxaccess start --enrollment-key-file ~/sxaccess-key \  --hostname build-mac-01

Resetting the agent

A Mac's identity is its private key, kept in /var/lib/sxaccess/default.json. Reset when that identity should not be reused: a Mac handed to someone else, a Mac moving to another organization for good, or state that a fresh sxaccess start no longer repairs. An expired session does not need this; sxaccess start renews it.

The steps are the same as on Linux, and the Mac comes back as a new device, with a new key and a new overlay address. First disconnect, undo the DNS and route changes the agent recorded, and stop the agent:

shell - reset, before the dashboard
sxaccess stopsxaccess store reset --allsudo sxaccess agent stop

Now delete the Mac under Devices in the dashboard. That revokes the old key, and it frees the Mac's DNS name: while the old entry exists, a new device gets that name with two numbers added.

Then delete the agent's state, which the agent creates again when it starts, and ~/Library/Application Support/sxaccess, which records which identity the CLI uses. Start the agent and sign in again. On a Mac nobody signs in at, end with sxaccess start --enrollment-key-file <file> instead, as in A Mac with nobody at it.

shell - reset, after the dashboard
rm -rf "$HOME/Library/Application Support/sxaccess"sudo rm -rf /var/lib/sxaccess &&  sudo sxaccess agent start &&  sxaccess start

Uninstalling

Unlike Linux, macOS has a single command for it. sudo sxaccess uninstall stops the agent and removes the LaunchDaemon, the socket and the binary. It deletes the logs and the settings, and resets /var/lib/sxaccess to this Mac's identity alone: its keys and the organization it enrolled in. Install again and sign in, and the Mac comes back as the same device instead of a new one.

Add --purge to remove the identity as well, so that the next sign-in adds a new device. Use it when the Mac leaves your organization for good, and delete the device under Devices in the dashboard, which revokes its key. --keep-data keeps everything instead: settings, logs and identity, as an upgrade would.

shell - uninstall, keep this Mac's identity
sudo sxaccess uninstall
shell - uninstall and remove the identity
sudo sxaccess uninstall --purge
shell - uninstall, keep settings, logs and identity
sudo sxaccess uninstall --keep-data