Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(macos): set up the host on first launch

leepokai9c53503058b0
diff --git a/README.md b/README.md
index 9e21fddd..53ea04a0 100644
--- a/README.md
+++ b/README.md
@@ -83,7 +83,7 @@ brew install --cask leepokai/codync/codync
All three install the same signed, notarized app.
-Open Codync in the menu bar → **Install host**. **Open Codync** opens the full window; **Pair iPhone…** shows the QR code.
+Open Codync: it sets up the host on first launch. **Open Codync** opens the full window; **Pair iPhone…** shows the QR code.
**Linux** — the host, plus the native GTK 4 / libadwaita app:
diff --git a/apps/macos/App/HostController.swift b/apps/macos/App/HostController.swift
index 271562e7..7ec1045e 100644
--- a/apps/macos/App/HostController.swift
+++ b/apps/macos/App/HostController.swift
@@ -208,15 +208,20 @@ final class HostController {
return
}
guard Self.devPort != nil || FileManager.default.fileExists(atPath: plistURL.path) else {
- state = .notInstalled
+ // The app is the way to run the host on a Mac: set it up right away, unless the user took it out.
+ if UserDefaults.standard.bool(forKey: Self.uninstalledKey) { state = .notInstalled } else { install() }
return
}
connect()
}
+ /// Set by "Uninstall host service", so the next launch doesn't put the host back.
+ private static let uninstalledKey = "hostUninstalled"
+
/// `codync-host install` also routes Claude Code's status line through the host.
func install() {
guard let bin = binaryURL else { return }
+ UserDefaults.standard.set(false, forKey: Self.uninstalledKey)
state = .starting
Task {
let result = await Self.run(bin, ["install", "--port", "\(Self.port)"])
@@ -230,6 +235,8 @@ final class HostController {
}
func restart() {
+ // Nothing to restart when the service was never set up (a failed install).
+ guard Self.devPort != nil || FileManager.default.fileExists(atPath: plistURL.path) else { return install() }
let uid = getuid()
Task {
_ = await Self.run(URL(filePath: "/bin/launchctl"), ["kickstart", "-k", "gui/\(uid)/com.pokai.codync.host"])
@@ -241,6 +248,7 @@ final class HostController {
func uninstall() {
guard let bin = binaryURL else { return }
streamTask?.cancel()
+ UserDefaults.standard.set(true, forKey: Self.uninstalledKey)
Task {
_ = await Self.run(bin, ["uninstall"])
if let local { accounts.detach(local.id) }
diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swift
index 647ab5bb..f99a83b8 100644
--- a/apps/macos/Views/ChatWindow.swift
+++ b/apps/macos/Views/ChatWindow.swift
@@ -16,15 +16,12 @@ struct ChatWindow: View {
ChatSplitView().id(host.contextID)
.transition(.opacity)
} else {
- EmptyState(
- icon: "desktopcomputer.trianglebadge.exclamationmark",
- title: "Codync host isn't running",
- message: "Open Codync from the menu bar to install or restart it."
- )
- .transition(.opacity.combined(with: .scale(scale: 0.97)))
+ hostState
+ .transition(.opacity.combined(with: .scale(scale: 0.97)))
}
}
.animation(Motion.reduced(Motion.layout, reduceMotion), value: showsChat)
+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: host.state)
.frame(minWidth: 760, minHeight: 500)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Palette.background)
@@ -42,6 +39,36 @@ struct ChatWindow: View {
}
}
+/// What stands between this Mac and the chat, with the one action that fixes it.
+private extension ChatWindow {
+ @ViewBuilder var hostState: some View {
+ switch host.state {
+ case .notInstalled:
+ EmptyState(
+ icon: "desktopcomputer",
+ title: "Set up this Mac",
+ message: "Codync runs your coding agents through the host, a small background service on this Mac.",
+ action: ("Install host", host.install)
+ )
+ case .missingBinary:
+ EmptyState(
+ icon: "desktopcomputer.trianglebadge.exclamationmark",
+ title: "The host is missing",
+ message: "This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub."
+ )
+ case .starting, .running:
+ EmptyState(icon: "desktopcomputer", title: "Starting the host…", message: "This takes a few seconds.")
+ case let .failed(message):
+ EmptyState(
+ icon: "desktopcomputer.trianglebadge.exclamationmark",
+ title: "The host isn't running",
+ message: message,
+ action: ("Try again", host.restart)
+ )
+ }
+ }
+}
+
/// The request being decided, swapped in place when the next one comes up; keeps the last
/// one on screen while the card animates away.
private struct CurrentApprovalSheet: View {
diff --git a/packaging/install.sh b/packaging/install.sh
index 3f8b87a5..699f19ce 100755
--- a/packaging/install.sh
+++ b/packaging/install.sh
@@ -115,7 +115,7 @@ install_linux_app() {
if [ $OS = macos ] && [ $HOST_ONLY = 0 ]; then
install_mac_app
echo
- echo "Codync is open in the menu bar: choose Install host, then Pair iPhone…"
+ echo "Codync is open and sets up the host on its own. Pair your iPhone from the menu bar: Pair iPhone…"
else
install_host
if [ $OS = linux ] && [ $HOST_ONLY = 0 ] && { [ $FORCE_APP = 1 ] || [ -n "${WAYLAND_DISPLAY:-}${DISPLAY:-}" ]; }; then