Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(setup): macOS .app bundle so Jarvis is discoverable + relaunchable (BUG-060)

Ruben Lütkeb6cfa40930f8
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 27d3640ba5..8f52745084 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -4287,3 +4287,33 @@ a source-build fallback is never satisfiable there, and every failure
message must name the actual failing layer — "check your internet" as a
catch-all turns a version gap into user gaslighting. "Newest Python
first" is wrong while the native wheel ecosystem lags a fresh CPython.
+
+## BUG-060: Closed the macOS desktop app — no way to relaunch it like a normal app (MEDIUM, FIXED 2026-07-14)
+
+**Symptom.** After the first successful macOS run, closing the desktop app
+left no path back for a normal user: Spotlight ("Personal Jarvis") found
+nothing, Launchpad and /Applications showed nothing — relaunch required a
+terminal command. A pip-based install ships no ``.app`` bundle, and macOS
+only surfaces bundles.
+
+**Fix (2026-07-14).** New ``jarvis/setup/macos_app_bundle.py``:
+``ensure_macos_app_bundle`` writes a minimal per-user
+``~/Applications/Personal Jarvis.app`` (Info.plist + a two-line bash
+executable exec'ing the install venv's Python desktop launcher + a
+best-effort ``jarvis.icns`` via PIL/iconutil). Spotlight indexes
+``~/Applications``, so Cmd+Space finds it. Wired into the installer's
+finish step (``step_macos_app``), removed by the uninstaller, and the
+installer's "Start again" hint now names Spotlight on macOS (the old
+``python -m …`` hint did not even work without the venv on PATH). Bonus:
+a real bundle gives TCC an identity — the mic prompt names "Personal
+Jarvis" with an honest ``NSMicrophoneUsageDescription`` instead of being
+attributed to whichever terminal started the process.
+
+Guards: ``tests/unit/setup/test_macos_app_bundle.py`` (bundle layout,
+plist incl. mic usage string, venv-python launcher script, idempotency,
+off-darwin no-op, icon best-effort).
+
+**Class rule.** "Installed" is not "discoverable": every OS needs its
+native launch surface (Windows Start-Menu shortcut, macOS ``.app``
+bundle, Linux XDG ``.desktop``) or closing the app strands the user. The
+Linux ``.desktop`` entry is the remaining gap of this class.
diff --git a/install/installer.py b/install/installer.py
index a8d8ed2141..ddb2ae9477 100644
--- a/install/installer.py
+++ b/install/installer.py
@@ -383,6 +383,34 @@ def step_shortcut(*, dry_run: bool) -> None:
note("could not create the Start-Menu shortcut - the app will retry on first launch")
+def step_macos_app(*, dry_run: bool) -> None:
+ """Finish & launch sub-step (macOS): a real .app so Spotlight/Launchpad
+ find Jarvis — without it, closing the app leaves no way back but the
+ terminal (BUG-060)."""
+ if sys.platform != "darwin":
+ return
+ if dry_run:
+ console.print("[muted] (dry-run) ensure_macos_app_bundle()[/]")
+ return
+ probe = (
+ "from jarvis.setup.macos_app_bundle import ensure_macos_app_bundle\n"
+ "print('ok' if ensure_macos_app_bundle() else 'skipped')\n"
+ )
+ try:
+ result = subprocess.run(
+ [str(venv_python()), "-c", probe], cwd=repo_root(),
+ capture_output=True, text=True, encoding="utf-8", errors="replace",
+ timeout=120,
+ )
+ outcome = (result.stdout or "").strip()
+ except (OSError, subprocess.TimeoutExpired):
+ outcome = ""
+ if outcome.endswith("ok"):
+ ok('app installed to ~/Applications - find it via Spotlight ("Personal Jarvis")')
+ else:
+ note("could not create the ~/Applications app - start via the install folder")
+
+
def step_ui_bundle_check() -> None:
"""Honest packaging check: the shipped UI build must be present + intact.
@@ -469,8 +497,16 @@ def step_summary(*, no_launch: bool, update: bool, headless: bool) -> None:
console.print(f" [muted]Installed to[/] {repo_root()}")
if sys.platform == "win32":
console.print(" [muted]Start again[/] [brand]run.bat[/] [muted](in the install folder)[/]")
+ elif sys.platform == "darwin":
+ console.print(
+ " [muted]Start again[/] [brand]Spotlight → \"Personal Jarvis\"[/] "
+ "[muted](app in ~/Applications)[/]"
+ )
else:
- console.print(" [muted]Start again[/] [brand]python -m jarvis.ui.web.launcher[/]")
+ console.print(
+ " [muted]Start again[/] [brand].venv/bin/python -m jarvis.ui.web.launcher[/] "
+ "[muted](in the install folder)[/]"
+ )
console.print(
" [muted]Update[/] [muted]re-run the same install one-liner - "
"it updates in place[/]"
@@ -555,6 +591,7 @@ def main(argv: list[str] | None = None) -> int:
phase("6/6", "Finish & launch")
step_worker_cli(dry_run=args.dry_run)
step_shortcut(dry_run=args.dry_run)
+ step_macos_app(dry_run=args.dry_run)
step_ui_bundle_check()
# Summary FIRST, launch LAST: when the app window appears, the terminal
diff --git a/jarvis/setup/macos_app_bundle.py b/jarvis/setup/macos_app_bundle.py
new file mode 100644
index 0000000000..84da26c367
--- /dev/null
+++ b/jarvis/setup/macos_app_bundle.py
@@ -0,0 +1,205 @@
+"""macOS ``.app`` bundle so Jarvis is discoverable like a real app (BUG-060).
+
+A plain pip install ships no bundle, so after closing the desktop app on a
+Mac there was no way back: Spotlight found nothing, Launchpad and
+``/Applications`` showed nothing, and relaunching required a terminal
+command. :func:`ensure_macos_app_bundle` writes a minimal per-user
+``~/Applications/Personal Jarvis.app`` whose executable is a two-line bash
+script exec'ing the install venv's Python desktop launcher — Spotlight
+indexes ``~/Applications``, so Cmd+Space finds "Personal Jarvis".
+
+Bonus: a real bundle gives TCC an identity. The microphone permission
+prompt names "Personal Jarvis" with the honest usage string below, instead
+of attributing (or denying) access to whichever terminal happened to start
+the process.
+
+The bundle build is pure stdlib file writes — CI-provable on any OS via the
+injectable directories (same pattern as ``jarvis/autostart/macos.py``). Only
+the optional icon conversion shells out to ``iconutil`` (darwin-only,
+best-effort: a missing icon never blocks the bundle).
+"""
+from __future__ import annotations
+
+import logging
+import plistlib
+import stat
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+log = logging.getLogger(__name__)
+
+APP_NAME = "Personal Jarvis"
+APP_DIR_NAME = f"{APP_NAME}.app"
+BUNDLE_ID = "com.personal-jarvis.desktop"
+_EXECUTABLE_NAME = "PersonalJarvis"
+
+_MIC_USAGE = (
+ "Personal Jarvis listens on this microphone for your wake word and "
+ "voice commands."
+)
+_APPLE_EVENTS_USAGE = (
+ "Personal Jarvis uses AppleScript to focus and arrange application "
+ "windows you ask it to control."
+)
+
+
+def _version() -> str:
+ try:
+ from jarvis import __version__
+
+ return __version__
+ except Exception: # noqa: BLE001 — version is cosmetic here
+ return "0.0.0"
+
+
+def _default_install_dir() -> Path:
+ """The install root — the parent of the ``jarvis`` package directory."""
+ import jarvis
+
+ return Path(jarvis.__file__).resolve().parents[1]
+
+
+def _venv_python(install_dir: Path) -> Path:
+ candidate = install_dir / ".venv" / "bin" / "python"
+ if candidate.exists():
+ return candidate
+ # Editable dev install / non-standard layout: whatever runs us now.
+ return Path(sys.executable)
+
+
+def _try_build_icns(resources_dir: Path) -> str | None:
+ """Best-effort ``jarvis.icns`` from the packaged PNG. darwin-only.
+
+ Returns the CFBundleIconFile stem, or ``None`` — a missing icon must
+ never block the bundle (macOS falls back to the generic app icon).
+ """
+ if sys.platform != "darwin":
+ return None
+ try:
+ from PIL import Image # noqa: PLC0415 — optional at this call site
+
+ src = Path(__file__).resolve().parents[1] / "assets" / "icons" / "jarvis.png"
+ if not src.is_file():
+ return None
+ with tempfile.TemporaryDirectory() as tmp:
+ iconset = Path(tmp) / "jarvis.iconset"
+ iconset.mkdir()
+ img = Image.open(src).convert("RGBA")
+ for size in (16, 32, 64, 128, 256, 512):
+ img.resize((size, size)).save(iconset / f"icon_{size}x{size}.png")
+ img.resize((size * 2, size * 2)).save(
+ iconset / f"icon_{size}x{size}@2x.png"
+ )
+ out = resources_dir / "jarvis.icns"
+ result = subprocess.run(
+ ["iconutil", "-c", "icns", str(iconset), "-o", str(out)],
+ capture_output=True,
+ text=True,
+ timeout=60,
+ check=False,
+ )
+ if result.returncode == 0 and out.is_file():
+ return "jarvis"
+ except Exception as exc: # noqa: BLE001 — icon is a nicety, never a blocker
+ log.debug("icns build skipped: %s", exc)
+ return None
+
+
+def ensure_macos_app_bundle(
+ *,
+ install_dir: Path | None = None,
+ applications_dir: Path | None = None,
+) -> Path | None:
+ """Write (or refresh) ``~/Applications/Personal Jarvis.app``.
+
+ Returns the bundle path, or ``None`` off darwin (unless
+ ``applications_dir`` is injected — the cross-platform test seam).
+ Never raises: a failed bundle write is logged and returns ``None`` —
+ the app itself keeps working, only rediscovery stays terminal-based.
+ """
+ if applications_dir is None:
+ if sys.platform != "darwin":
+ log.info("App bundle skipped: only macOS uses .app bundles.")
+ return None
+ applications_dir = Path.home() / "Applications"
+ try:
+ install_root = install_dir or _default_install_dir()
+ python = _venv_python(install_root)
+
+ bundle = applications_dir / APP_DIR_NAME
+ contents = bundle / "Contents"
+ macos_dir = contents / "MacOS"
+ resources = contents / "Resources"
+ macos_dir.mkdir(parents=True, exist_ok=True)
+ resources.mkdir(parents=True, exist_ok=True)
+
+ exe = macos_dir / _EXECUTABLE_NAME
+ exe.write_text(
+ "#!/bin/bash\n"
+ "# Launches the Personal Jarvis desktop app from its install venv.\n"
+ f'exec "{python}" -m jarvis.ui.web.launcher "$@"\n',
+ encoding="utf-8",
+ )
+ exe.chmod(
+ exe.stat().st_mode
+ | stat.S_IXUSR
+ | stat.S_IXGRP
+ | stat.S_IXOTH
+ )
+
+ info: dict[str, object] = {
+ "CFBundleName": APP_NAME,
+ "CFBundleDisplayName": APP_NAME,
+ "CFBundleIdentifier": BUNDLE_ID,
+ "CFBundleExecutable": _EXECUTABLE_NAME,
+ "CFBundlePackageType": "APPL",
+ "CFBundleShortVersionString": _version(),
+ "CFBundleVersion": _version(),
+ "LSMinimumSystemVersion": "11.0",
+ "NSHighResolutionCapable": True,
+ "NSMicrophoneUsageDescription": _MIC_USAGE,
+ "NSAppleEventsUsageDescription": _APPLE_EVENTS_USAGE,
+ }
+ icon_stem = _try_build_icns(resources)
+ if icon_stem is not None:
+ info["CFBundleIconFile"] = icon_stem
+
+ with (contents / "Info.plist").open("wb") as fh:
+ plistlib.dump(info, fh)
+
+ log.info("macOS app bundle written: %s", bundle)
+ return bundle
+ except Exception as exc: # noqa: BLE001 — rediscovery nicety, never fatal
+ log.warning("macOS app bundle could not be written: %s", exc)
+ return None
+
+
+def remove_macos_app_bundle(*, applications_dir: Path | None = None) -> bool:
+ """Delete the bundle (uninstall path). Returns True when it is gone."""
+ if applications_dir is None:
+ if sys.platform != "darwin":
+ return True
+ applications_dir = Path.home() / "Applications"
+ bundle = applications_dir / APP_DIR_NAME
+ if not bundle.exists():
+ return True
+ try:
+ import shutil
+
+ shutil.rmtree(bundle)
+ log.info("macOS app bundle removed: %s", bundle)
+ return True
+ except OSError as exc:
+ log.warning("Could not remove %s: %s", bundle, exc)
+ return False
+
+
+__all__ = [
+ "APP_DIR_NAME",
+ "APP_NAME",
+ "BUNDLE_ID",
+ "ensure_macos_app_bundle",
+ "remove_macos_app_bundle",
+]
diff --git a/jarvis/setup/uninstall.py b/jarvis/setup/uninstall.py
index cbb28dc425..0f84490e36 100644
--- a/jarvis/setup/uninstall.py
+++ b/jarvis/setup/uninstall.py
@@ -207,6 +207,14 @@ def _remove_autostart() -> None:
_console.print(" [muted]→ login autostart not supported here — skipped.[/]")
except Exception as exc: # noqa: BLE001 — never abort the uninstall on this
_console.print(f" [bad]⚠ could not remove the autostart entry: {escape(str(exc))}[/]")
+ if sys.platform == "darwin":
+ try:
+ from jarvis.setup.macos_app_bundle import remove_macos_app_bundle
+
+ if remove_macos_app_bundle():
+ _console.print(" [ok]→ ~/Applications app bundle removed.[/]")
+ except Exception as exc: # noqa: BLE001 — never abort the uninstall on this
+ _console.print(f" [bad]⚠ could not remove the app bundle: {escape(str(exc))}[/]")
def _remove_keys(keys: list[str]) -> int:
diff --git a/tests/unit/setup/test_macos_app_bundle.py b/tests/unit/setup/test_macos_app_bundle.py
new file mode 100644
index 0000000000..36362fca7c
--- /dev/null
+++ b/tests/unit/setup/test_macos_app_bundle.py
@@ -0,0 +1,86 @@
+"""macOS .app bundle writer (BUG-060).
+
+After closing the desktop app on a Mac there was no way back: Spotlight and
+/Applications showed nothing because a plain pip install ships no bundle.
+``ensure_macos_app_bundle`` writes a per-user ``Personal Jarvis.app`` whose
+executable script exec's the venv Python desktop launcher. Contracts:
+
+- correct bundle layout + Info.plist (incl. NSMicrophoneUsageDescription —
+ a bundled process gets its own TCC identity, so the mic prompt must carry
+ an honest usage string instead of being killed for lacking one),
+- launcher script points at the install's venv python and the launcher module,
+- idempotent re-runs, no-op off darwin without an explicit override.
+
+Pure file writes — provable on any OS via injectable directories (same
+pattern as jarvis/autostart/macos.py).
+"""
+from __future__ import annotations
+
+import os
+import plistlib
+import stat
+from pathlib import Path
+
+from jarvis.setup.macos_app_bundle import (
+ APP_DIR_NAME,
+ ensure_macos_app_bundle,
+)
+
+
+def _build(tmp_path: Path) -> Path:
+ install_dir = tmp_path / "install"
+ (install_dir / ".venv" / "bin").mkdir(parents=True)
+ (install_dir / ".venv" / "bin" / "python").write_text("", encoding="utf-8")
+ apps = tmp_path / "Applications"
+ bundle = ensure_macos_app_bundle(
+ install_dir=install_dir, applications_dir=apps
+ )
+ assert bundle is not None
+ return bundle
+
+
+def test_bundle_layout_and_plist(tmp_path: Path) -> None:
+ bundle = _build(tmp_path)
+ assert bundle.name == APP_DIR_NAME # "Personal Jarvis.app"
+ plist_path = bundle / "Contents" / "Info.plist"
+ with plist_path.open("rb") as fh:
+ info = plistlib.load(fh)
+ assert info["CFBundleExecutable"] == "PersonalJarvis"
+ assert info["CFBundleIdentifier"] == "com.personal-jarvis.desktop"
+ assert info["CFBundlePackageType"] == "APPL"
+ # TCC: a bundled app is killed on first mic open without a usage string.
+ assert "microphone" in info["NSMicrophoneUsageDescription"].lower()
+ exe = bundle / "Contents" / "MacOS" / "PersonalJarvis"
+ body = exe.read_text(encoding="utf-8")
+ assert body.startswith("#!/bin/bash")
+ assert "jarvis.ui.web.launcher" in body
+ assert ".venv" in body # exec's the install venv's python
+ if os.name == "posix":
+ assert exe.stat().st_mode & stat.S_IXUSR
+
+
+def test_rerun_is_idempotent(tmp_path: Path) -> None:
+ first = _build(tmp_path)
+ second = ensure_macos_app_bundle(
+ install_dir=tmp_path / "install",
+ applications_dir=tmp_path / "Applications",
+ )
+ assert second == first
+ with (first / "Contents" / "Info.plist").open("rb") as fh:
+ assert plistlib.load(fh)["CFBundleExecutable"] == "PersonalJarvis"
+
+
+def test_noop_off_darwin_without_override(monkeypatch) -> None:
+ monkeypatch.setattr("sys.platform", "linux")
+ assert ensure_macos_app_bundle() is None
+
+
+def test_missing_icon_tooling_still_builds_bundle(tmp_path: Path, monkeypatch) -> None:
+ # iconutil/PIL failures are best-effort: no icon key, bundle still works.
+ import jarvis.setup.macos_app_bundle as mab
+
+ monkeypatch.setattr(mab, "_try_build_icns", lambda _res: None)
+ bundle = _build(tmp_path)
+ with (bundle / "Contents" / "Info.plist").open("rb") as fh:
+ info = plistlib.load(fh)
+ assert "CFBundleIconFile" not in info