macOS: run illogicald on a Mac #16

Closed
opened 2026-10-02 00:50:25 +00:00 by jhgaylor · 1 comment
Owner

Run illogicald on a Mac, so it can be added to the host list and its tabs reached from the page and the CLI.

A cross-check for aarch64-apple-darwin (2026-10-01, with zig cc as the C compiler) found that core, proto, vt (libghostty included) and the illogical CLI compile; illogicald has the errors below.

Compile errors

  • agent/link.rs: pipe2 doesn't exist on macOS; use pipe and set FD_CLOEXEC.
  • pane.rs wait_for_exit: pidfd_open is Linux-only; use kqueue (EVFILT_PROC / NOTE_EXIT).
  • shim.rs: the TIOCSCTTY ioctl request type differs (a cast).
  • sys.rs: systemd notify uses an abstract socket and SOCK_CLOEXEC; compile it on Linux only (it is already a no-op without systemd).
  • Whatever else turns up once these are fixed.

Runtime (compiles, but reads /proc)

  • Process exit. Without pidfd, wait_for_exit skips the wait and gives up on the shim's record after a short timeout, so panes can be marked exited while still running, or lose their exit codes. Covered by the kqueue fix.
  • fs (M7). open and list use /proc/self/fd to check what was opened; every listing would fail. Use fcntl(F_GETPATH) and fdopendir.
  • Pane info. cwd (pane.rs), the foreground process and the process method, and the shim's start-time guard read /proc/PID/{cwd,stat,cmdline}. Use libproc (proc_pidinfo, KERN_PROCARGS2).
  • Tailscale local API. tailscale.rs only knows the Linux socket paths. Homebrew tailscaled uses /var/run/tailscale/tailscaled.sock; the Mac GUI app has a different local API. Only matters for direct listeners; behind tailscale serve, identity comes from request headers.
  • zsh shell integration: shipped but untested, and zsh is the macOS default.
  • Linux-only features (wisp VMs, systemd scopes, the FD store, the systemd environment merge, the static-musl sandbox installer) report themselves unavailable instead of failing.

Service

  • illogicald install writes a launchd LaunchAgent (~/Library/LaunchAgents, RunAtLoad, KeepAlive) and loads it with launchctl bootstrap.
  • Without systemd there are no per-pane scopes or FD store: restarting the daemon on the Mac ends its shells (pre-M2b behaviour). Accepted for now.
  • README: Mac setup (Xcode CLT, Zig, tailscale serve, hosts add, --allow-origin).

CI

  • A macOS build and test job, so it stays working.

Done when

  • illogicald builds and runs on a Mac and starts at login.
  • From geek's page, the host switcher reaches the Mac: open a tab, run vim, close the browser, reopen it, and vim is intact.
  • illogical --host mac run --wait -- uname prints Darwin.
  • The file picker lists directories on the Mac, and a shell's exit code reaches its pane.
Run `illogicald` on a Mac, so it can be added to the host list and its tabs reached from the page and the CLI. A cross-check for `aarch64-apple-darwin` (2026-10-01, with `zig cc` as the C compiler) found that `core`, `proto`, `vt` (libghostty included) and the `illogical` CLI compile; `illogicald` has the errors below. ### Compile errors - [ ] `agent/link.rs`: `pipe2` doesn't exist on macOS; use `pipe` and set `FD_CLOEXEC`. - [ ] `pane.rs` `wait_for_exit`: `pidfd_open` is Linux-only; use kqueue (`EVFILT_PROC` / `NOTE_EXIT`). - [ ] `shim.rs`: the `TIOCSCTTY` ioctl request type differs (a cast). - [ ] `sys.rs`: systemd notify uses an abstract socket and `SOCK_CLOEXEC`; compile it on Linux only (it is already a no-op without systemd). - [ ] Whatever else turns up once these are fixed. ### Runtime (compiles, but reads `/proc`) - [ ] **Process exit.** Without `pidfd`, `wait_for_exit` skips the wait and gives up on the shim's record after a short timeout, so panes can be marked exited while still running, or lose their exit codes. Covered by the kqueue fix. - [ ] **`fs` (M7).** `open` and `list` use `/proc/self/fd` to check what was opened; every listing would fail. Use `fcntl(F_GETPATH)` and `fdopendir`. - [ ] **Pane info.** cwd (`pane.rs`), the foreground process and the `process` method, and the shim's start-time guard read `/proc/PID/{cwd,stat,cmdline}`. Use `libproc` (`proc_pidinfo`, `KERN_PROCARGS2`). - [ ] **Tailscale local API.** `tailscale.rs` only knows the Linux socket paths. Homebrew `tailscaled` uses `/var/run/tailscale/tailscaled.sock`; the Mac GUI app has a different local API. Only matters for direct listeners; behind `tailscale serve`, identity comes from request headers. - [ ] **zsh shell integration**: shipped but untested, and zsh is the macOS default. - [ ] Linux-only features (wisp VMs, systemd scopes, the FD store, the systemd environment merge, the static-musl sandbox installer) report themselves unavailable instead of failing. ### Service - [ ] `illogicald install` writes a launchd LaunchAgent (`~/Library/LaunchAgents`, `RunAtLoad`, `KeepAlive`) and loads it with `launchctl bootstrap`. - [ ] Without systemd there are no per-pane scopes or FD store: restarting the daemon on the Mac ends its shells (pre-M2b behaviour). Accepted for now. - [ ] README: Mac setup (Xcode CLT, Zig, `tailscale serve`, `hosts add`, `--allow-origin`). ### CI - [ ] A macOS build and test job, so it stays working. ### Done when - `illogicald` builds and runs on a Mac and starts at login. - From geek's page, the host switcher reaches the Mac: open a tab, run vim, close the browser, reopen it, and vim is intact. - `illogical --host mac run --wait -- uname` prints `Darwin`. - The file picker lists directories on the Mac, and a shell's exit code reaches its pane.
Author
Owner

Done. jake-mini runs illogicald under launchd, behind the Tailscale app's serve, and is in geek's host list. Checked:

  • illogical --host jake-mini run --wait -- uname from geek prints Darwin;
  • fs ls lists the Mac's directories, and exit codes reach their panes;
  • from geek's page in a browser, a jake-mini tab running vim survives closing and reopening the page (confirmed by Jake);
  • CI: just check-macos on Linux, plus a native macos-arm64 job in check.yml.
    Restarts keeping panes landed separately in #18.
Done. jake-mini runs illogicald under launchd, behind the Tailscale app's serve, and is in geek's host list. Checked: - `illogical --host jake-mini run --wait -- uname` from geek prints `Darwin`; - `fs ls` lists the Mac's directories, and exit codes reach their panes; - from geek's page in a browser, a jake-mini tab running vim survives closing and reopening the page (confirmed by Jake); - CI: `just check-macos` on Linux, plus a native `macos-arm64` job in check.yml. Restarts keeping panes landed separately in #18.
Sign in to join this conversation.
No description provided.