Skip to content

Add macOS support#4

Open
laprasoc wants to merge 1 commit intochrysb:mainfrom
laprasoc:codex/macos-support
Open

Add macOS support#4
laprasoc wants to merge 1 commit intochrysb:mainfrom
laprasoc:codex/macos-support

Conversation

@laprasoc
Copy link

@laprasoc laprasoc commented Mar 9, 2026

Summary

  • add shared platform-aware sync scheduling so Linux keeps /etc/cron.d while macOS runs the saved five-field cron schedule from AlphaClaw's managed in-process scheduler
  • update startup to install gog and shim binaries into AlphaClaw's managed internal bin on macOS instead of assuming /usr/local/bin
  • fix AlphaClaw startup ordering so ALPHACLAW_ROOT_DIR and PORT are resolved before server constants are imported, which makes local macOS roots and ports behave correctly
  • cover the macOS onboarding/system scheduling flows in tests and update the README platform note

Testing

  • npm test -- tests/server/routes-system.test.js tests/server/routes-onboarding.test.js
  • live-tested node bin/alphaclaw.js --root-dir /tmp/alphaclaw-live-test start against an existing local .openclaw on macOS
  • live-tested AlphaClaw against a persistent local root and verified the UI served successfully on the configured port without modifying the host crontab

@laprasoc laprasoc force-pushed the codex/macos-support branch from 899a7d0 to 9513ea6 Compare March 9, 2026 05:16

installHourlyGitSyncScript({ fs, openclawDir: OPENCLAW_DIR });
await installHourlyGitSyncCron({ fs, openclawDir: OPENCLAW_DIR });
await installHourlyGitSyncCron({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, the managed scheduler only starts during process startup in bin/alphaclaw.js when the sync script already exists. In a fresh onboarding flow, we create the script/config here, but never start the scheduler in-process afterward, so hourly sync will not run until the service restarts. Can we start the managed scheduler after successful cron config install on darwin (or have installHourlyGitSyncCron do that) so onboarding is immediately effective?

const normalizeCronPlatform = (platform = os.platform()) =>
platform === "darwin" ? "darwin" : "linux";

const isValidCronSchedule = (value) =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isValidCronSchedule currently accepts any 5-token expression, but the managed scheduler matcher below only supports numeric tokens (*, ranges, steps, comma lists). Schedules like 0 9 * * MON will be accepted/saved but can never match on macOS, so sync silently never runs. Can we either tighten validation to supported syntax or add parser support for named day/month tokens?

Copy link
Owner

@chrysb chrysb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great direction overall on macOS support and shared cron plumbing. I'm requesting changes for two blockers:

  1. On fresh macOS onboarding, the managed scheduler is not started after cron/script install, so hourly sync does not run until a restart.
  2. Cron validation accepts schedules the managed parser cannot execute (e.g. named weekdays), which can silently disable sync on macOS.

I left inline comments on both code paths with suggested fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants