Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

background-service.md

73 lines2.8 KB

1# Running T3 Code in the Background
2​
3On Linux and macOS, T3 Code can run as a background service for your user, so it is ready without
4keeping a terminal open.
5​
6## Manage the Service
7​
8Install it with the latest T3 Code release:
9​
10```sh
11npx t3@latest service install
12```
13​
14Check whether it is installed:
15​
16```sh
17npx t3@latest service status
18```
19​
20Update or repair it:
21​
22```sh
23npx t3@latest service update
24```
25​
26Stop it and remove it from startup:
27​
28```sh
29npx t3@latest service uninstall
30```
31​
32Updating restarts T3 Code briefly. Let active agent work and terminal commands finish first.
33If a remote update is already in progress, wait for it to finish before retrying a local update.
34​
35The service runs a small stable launcher. Exact T3 Code versions are installed separately, so a
36failed remote candidate can return to the previous version without rewriting the service
37definition. The launcher snapshots the database before a remote candidate starts, so database
38updates roll back with the server version. An older launcher may require one local
39`service update` before this is available.
40​
41## Platform Support
42​
43**Linux** uses a systemd user unit at `~/.config/systemd/user/t3code.service`. The service starts
44when the machine boots and keeps running after you log out (lingering is enabled during install).
45​
46**macOS** uses a launch agent at `~/Library/LaunchAgents/com.t3tools.t3code.service.plist`. It
47starts when you log in, not when the Mac boots, and it stops when you log out; macOS has no
48equivalent of Linux lingering for user agents. For a Mac that should stay reachable unattended,
49turn on automatic login (System Settings → Users & Groups; unavailable while FileVault is on) and
50keep the Mac from sleeping.
51​
52A few more macOS notes:
53​
54- Installing over SSH needs someone logged in at the Mac's screen to start the agent right away.
55 Without that, the install command reports an error at the final start step, but the agent is
56 fully installed and starts at the next login.
57- macOS may show privacy prompts for protected folders such as Desktop, Documents, or Downloads,
58 attributed to a bare `node` process, or deny access without a prompt. If agent work fails to
59 read those folders, grant Full Disk Access to the node binary listed in the launch agent's
60 `ProgramArguments`.
61- The agent appears under System Settings → General → Login Items. If it was switched off there,
62 or disabled with `launchctl disable`, macOS will not start it at login until you switch it back
63 on.
64​
65**Windows** is not supported yet.
66​
67## Using It with T3 Connect
68​
69T3 Connect may offer to install the service during setup so the host stays reachable in the
70background. This is only an onboarding shortcut: the service and T3 Connect are managed separately.
71​
72Signing out of T3 Connect does not remove the service. Use `t3 service uninstall` when you no longer
73want T3 Code to start in the background.