Tutorial 7: Running malac on a server
The agents do not have to run on your laptop. In this tutorial you install malac on a Linux server, pair your Mac with the server’s daemon through an SSH tunnel, start work in the full-screen UI, close the laptop, and check on the agents later from the Mac or a phone.
You need a Linux server you can reach with ssh devbox (any name works; replace devbox throughout), a Mac with malac from tutorial 1, and a provider key for the server. Nothing on the server is exposed to the network: the SSH tunnel is the only way in.
Set up the server
Section titled “Set up the server”-
Install malac on the server.
ssh devboxcurl -fsSL https://raw.githubusercontent.com/lobirus/malac/main/install.sh | shThe script picks the Linux x86-64 release archive and puts
malacandmalac-controlin~/.local/bin; on other machines it builds from source. Add~/.local/binto yourPATHif the script says so. -
Add a provider on the server. Models, keys, MCP servers and plugins are the server’s configuration; the Mac needs none of it.
printf '%s' "$LORA_API_KEY" | malac provider add lora \--base-url https://lora.example.com/v1 --model default --api-key-stdin --set-default -
Keep the daemon running. By default the daemon exits after two idle hours. On a server, let it run:
cat >> ~/.malac/config.toml <<'EOF'[daemon]idle_minutes = 0EOF -
Get a project onto the server, for example by cloning a repository you work on:
git clone <your repository> ~/src/app -
Create a pairing code. This starts the daemon, which runs in its own session and keeps running after you log out.
malac remote pairPairing code ABCDE-FGHJK valid for 10 minutes, for one device(a QR code)scan it with a phone, or open http://127.0.0.1:7700/#pair=ABCDE-FGHJKSSH tunnel malac remote add <name> http://127.0.0.1:7700 --pair ABCDE-FGHJK! remote access is off: only this machine and SSH tunnels can pair and connect; `malac daemon restart --remote` opens it to other devicesRemote access is off, and that is what you want here: through an SSH tunnel, the daemon sees requests that come from its own machine. Keep the code for the next part.
Pair the Mac
Section titled “Pair the Mac”-
Open the tunnel. In a separate terminal tab on the Mac, forward a local port to the server’s daemon. Use a port other than 7700, which your Mac’s own daemon may use:
ssh -N -L 7701:127.0.0.1:7700 devboxIt prints nothing and keeps running. Leave it open while you work.
-
Save the connection with the code.
malac remote add devbox http://127.0.0.1:7701 --pair ABCDE-FGHJKpaired as macbook (3f2a9c1e) with malac 1.1.0 at http://127.0.0.1:7701saved `devbox`: malac 1.1.0 with 0 workspaces · `malac -C devbox` connectsThe Mac now has a device token of its own, in
~/.malac/connections.json. The code is used up. -
Check the connection.
malac remote listIt lists
devboxwith its address and whether it answers.
Work on the server
Section titled “Work on the server”-
Open the terminal UI on the server’s daemon.
malac -C devboxIt looks like a local session, with two differences: the header shows
devbox › default, and the status line starts with@devbox. The choice is remembered, so a plainmalacreconnects todevboxnext time;malac -C localcomes back to your Mac. -
Open the project. Paths are the server’s, and a new tab starts in the server’s home folder:
/cd ~/src/app -
Give it something that takes a while, so there is something to come back to:
run the whole test suite, fix what fails, and summarize the fixesTool calls, approvals and subagents work as they do locally; the commands run on the server.
-
Leave. Press F10, or close the laptop. The agents keep working in the server’s daemon. Commands they start in the background, such as a dev server, keep running as jobs.
-
Come back. Open the tunnel again if it closed, and run
malac. The tab is where you left it, with the agent’s answer, or a permission request waiting for you.
Instead of opening the terminal UI, you can also send a prompt straight away: malac -C devbox -p "what changed in the last commit?" prints the answer and exits.
Check in from a phone
Section titled “Check in from a phone”A phone cannot use your SSH tunnel, so it needs a way to the server. Tailscale is the private option: if the server and the phone are on the same tailnet, turn remote access on and let malac run Tailscale Serve.
-
On the server, allow paired devices, keeping the daemon off the network:
malac daemon restart --remote --host 127.0.0.1malac tunnel tailscaleThe restart is refused while agents or jobs run, so wait for the test run to finish.
malac tunnelprints the tailnet address. The daemon stops the tunnel when it stops; set[remote] tunnel = "tailscale"andweb.remote = trueto have both on every start. -
Create a code with
malac remote pair. With the tunnel running, the QR code points to the tailnet address. -
Scan it with the phone’s camera. The browser opens the web UI’s pairing form with the code filled in. Name the device and pair. The phone keeps its token and stays paired until you revoke it.
The web UI on the phone shows the same workspace and tabs, the transcript, the jobs, and the approvals waiting for you. The mobile apps will pair the same way.
Clean up
Section titled “Clean up”List the paired devices on the server and revoke the ones you no longer use:
malac remote devicesmalac remote revoke <id>A revoked device’s token stops working at once and its connections close. On the Mac, malac remote remove devbox forgets the connection and revokes its token when the server answers.
What you learned
Section titled “What you learned”- The daemon on a server holds the agents; clients pair once and connect with a device token of their own. See Remote access.
- An SSH tunnel needs no remote access at all, and exposes nothing.
malac -C <name>points the terminal UI, the line mode and one-off prompts at a saved connection, and paths name the server’s files.malac tunnelgives the daemon an address that other devices can reach: Tailscale for your tailnet, Cloudflare or ngrok for a public one.
malac is created by lobirus and released under the MIT license. About malac