Try native on Apple Silicon
Start here: 1. Install · 2. First project · 3. Upgrade · 4. Try native.
Native is an opt-in preview for Apple Silicon Macs. It runs services in Hack's Linux VM instead of Docker. Use a disposable project with synthetic data. Native does not move Compose volumes or support every Compose feature. Read the limits first.
Prepare the runtime
From your project, choose native and prepare the runtime bundled with your standard Hack install.
hack config set runtime.engine native
hack native setup
# Noninteractive downloads need explicit consent:
hack native setup --accept-downloads --jsonSetup shows file sizes, download hosts, hashes and locations, then asks once for
consent. Read the list. It includes the image builder that build: services
need; a home that an earlier build set up gains it with
native setup --accept-downloads (the image builder).
A matching install is checked and reused. Noninteractive
up refuses until setup is complete; interactive up can offer setup with the
same consent and continue after success. For offline inputs or an interrupted
download, use setup and recovery details.
hack-next keeps its receipt-owned home and refuses a differing
HACK_NATIVE_HOME. For manual bundles and moving homes, see
home selection.
Check before starting
hack upgrade check reviews a project's native configuration, but not runtime
setup or runtime admission, so a clean result there is not permission to start. Run setup above and the full preflight below.
hack doctor --native-preflight --path /absolute/projectNative hack up selects Compose profiles as Compose does: --profile, else
COMPOSE_PROFILES in the managed env (for example .hack/hack.env.default.yaml),
else in the shell (a COMPOSE_PROFILES stored as a secret selects nothing).
Preflight selects them the same way, so without --profile it reviews the services
a fresh up starts. A run that already exists keeps the profiles it started
with; when the env now selects others, up says so, and changing them means
hack down --remove-data (this deletes the data volumes) and hack up.
Preflight reads the Compose project and lists blockers with fixes. It starts no VM or service. Continue only
when there are no blockers and the report says Runtime review: completed.
The runtime setup item must also say ready. In JSON, this means ready: true
and runtime_review.status: "completed".
An exit of 0 alone is not enough: runtime review can be skipped or unavailable.
If blocked, fix the named field and rerun. For a project that already runs on Compose, Run an existing Compose project on native collects the usual fixes. Do not remove a check or delete state to force a start. Keep the project on Compose if it needs unsupported behavior. See Troubleshooting and the preflight reference.
The environment-file rules explain which env files native reads, which declarations refuse and how to fix them.
Start, check and stop
hack up --detach --path /absolute/project
hack ps --path /absolute/project
hack logs api --no-follow --tail 50 --path /absolute/projectReplace api with a service in your project. Start still checks images, source
sharing, credentials, ownership and readiness. Preflight does not prove these.
If writable source sharing asks for consent, review the exact source roots and
sharing limits before
opting in. Check the app and saved data yourself; a running VM is not acceptance.
If a service's own process exits before the start is ready, for example because
its command names a script that does not exist, up stops the failed start and
fails with E_SERVICE_EXITED. The message names each service and its exit code
("Service app exited with code 1 during startup"). An exit with code 0 before
readiness is reported the same way. This applies only when the exit is the
start's first failure: if another service failed first (for example a database
that never became healthy) and a dependent service then exited, up reports the
first failure and still prints each failed service's last lines.
With --json, error.detail.services lists
each service's name and exitCode, and error.detail.nativeCode keeps the
runtime's own code. A foreground up also prints each failed service's last
output lines with managed values redacted. A detached up never carries service
output, so run hack up without -d in a terminal to see them.
For a native project backed by a Compose file, use hack up redis or pass
several service names to start that selection and its depends_on dependencies.
Hack adds them to the current run if the project is already up. Running services
keep their container IDs and publications, and hack ps shows the combined run.
hack up redis --json uses the same lifecycle fields as a targeted Compose
start. An unknown service returns E_SERVICE_NOT_FOUND.
A later plain hack up starts the other active services. An already-owned
stopped service starts again. Running services keep the settings they started
with. Hack reports a warning if a selected running service's Compose declaration
changed. On native, use hack restart to apply those changes. An instance started
with up -d restarts in the background. For Compose-file projects the command
returns once the containers have started, while HTTPS routes finish warming. Use
restart --wait to wait for readiness. A foreground instance restarts in the
terminal. If the owner is
still warming or starting another selection, a second targeted start returns
E_NATIVE_STILL_STARTING through the owner. Use hack ps to check its progress
and retry.
A targeted start sends the owner a review of the whole Compose file. If that
review no longer matches what the run recorded (for example, a running service's
definition or the source changed since the run started), the owner records its
own review of the combined services instead, and up warns that it did. The
start still succeeds. A later restore of this run, after a retaining
hack down, has to reconcile that review: it refuses when the run uses live
source sharing, carries a source cache scope or has a pending initializer cache
release.
Adding routes or loopback ports requires enough free bridge sockets in the running pool. Hack checks capacity before recording or creating the selected services. Adding host relay bindings still requires a fresh graph start.
On failure, the owner tries to remove the new resources and returns previously
stopped services to a stopped state with their routes and loopback ports closed.
A retry can start and publish those services again. If the owner cannot confirm
rollback, hack ps reports a degraded run and shows the service states it can
verify. Restart supervision continues for services outside the failed start.
Ctrl-C asks the owner to cancel the append. up prints the number of services it
may need to roll back. Its wait budget covers their stop grace periods in sequence,
plus time for the owner to notice the cancellation and finish cleanup. If the owner
confirms rollback, up reports cancellation and exits
130. A second Ctrl-C ends the wait while the owner continues cleanup. If the
append committed or up stops waiting without confirmation, it reports
E_NATIVE_START_OUTCOME_UNKNOWN and asks you to check hack ps.
hack down cancels the start and stops the whole run, including any service
created midway. The owner can answer after an in-flight image inspection,
volume preparation or container operation settles. Confirmed
hack down --remove-data during a service append also cancels it and stops
the run, then removes its owned volumes once the stop is confirmed.
If the add finished or rolled back while you were confirming, nothing is
removed and the project keeps running; run hack down, then
hack down --remove-data.
If the owner exited, use
hack down --recover. Recovery uses the last committed receipt for cleanup
and keeps interrupted writes as evidence. After a retaining down, ps shows
stopped-data-retained. A later up selects services from the current Compose
review and reattaches the named data that those services still use.
Older hack-next versions cannot read these run receipts. Run hack down
before you roll back.
Build base registry refusal (registry_image). Foreground and detached
starts can report Image unavailable: could not resolve build base when the
registry cannot resolve a Dockerfile base. Check the reported reason, restore
registry access, then retry hack up. Already present lists images Hack
confirmed in the running guest. It does not confirm that the named build base
can be resolved offline.
Use
hack exec api -- /bin/sh from a foreground terminal for a live shell.
Terminal stdin and stdout are required; redirects or HACK_NO_INTERACTIVE=1
select finite exec, which waits up to 30 seconds; with fresh per-command values, a command that
finished on a busy host still returns its output and exit code. Use the matching runtime, and restart old managed-env
launchers if requested. After an uncertain outcome, inspect
hack exec-sessions and follow the
recovery instructions.
Native up, up --detach and up --json return once every container has started;
the closing line counts the routes still warming, and --json says
readiness: "warming". up --wait returns once every service is ready, every route answers
and the service behind each published loopback port has accepted a connection. The foreground
"All services ready" line waits for the same checks. A port whose host listener is bound
before the service listens is still warming; if the service never accepts within the start
budget, --wait fails and names the port.
up.after hooks run at started: a hook that calls a project URL needs --wait.
hack exec and hack run wait for ready on their own; hack open does not.
A service that fails after up returned stops the run with its data retained;
hack ps names it and why, and ps --json lists it in failed.
The detached summary shows the HTTPS route URL while it warms. With no HTTPS route, it shows a published loopback address if available.
It prefers a confirmed port when available. While ports are warming, it shows where the first reviewed port will listen.
During startup, hack ps shows verified loopback publications, and
hack open <service> can open a service with one verified loopback address.
Other services can still be starting. If the start fails or is cancelled,
the owner retires the ports it has already published. HTTPS requests can succeed once the frontend is ready.
Once HTTPS is ready for a project, starting or stopping another project in the
same native home leaves its routes available.
If ps reports process_identity_unavailable, it could not verify service status.
Run "$CANDIDATE" doctor to inspect the pool. If the VM exited,
"$CANDIDATE" native recover recovers the selected home.
If the VM provider exits unexpectedly, run "$CANDIDATE" up -d again to recover the
project with its data retained. The new start owns the replacement boot and
keeps its HTTPS routes and loopback ports served after recovery.
During a detached start, stderr reports when the pool and each image are ready,
which builds finished or reused an image, and which services started. These
lines also appear with --json. A one-shot service gets one started line;
its completion appears in the final result on stdout. A build
failure names its service and stage. The failure message gives the path to
the last 64 KiB of owner stderr in the failed attempt’s private run directory.
This file can contain environment values. The next native up or down for the
project retires previous failed attempts, even when there is no live owner to stop.
When starts overlap, Hack keeps at most the three latest failed attempts per project.
See native command forms and startup limits for the
separate detached and graph readiness limits. If detached startup times out,
run down next. It waits up to two minutes for a pending owner and stops what
the owner published, or reports E_DOWN_INCOMPLETE if it cannot prove the stop.
Retry after the stop is confirmed.
Stop with the same version and native home:
hack down --path /absolute/projectIf a foreground up is lost (its terminal closed or the process was killed)
while its services run, run hack down --recover --path /absolute/project,
then hack up to start it again. The graph owner notices that its
frontend went and stops the services on its own, with data retained. down --recover stops an owner that is still running through its own cleanup,
waits for one that is finishing its own stop (within the command's budget,
HACK_COMPOSE_STARTUP_TIMEOUT_MS, 90 s by default), accepts the stop the
owner already made, or recovers an owner that died before or after its stop, and
it finishes the lost frontend's shutdown. If the owner is still exiting when
that wait ends, run the same command again once it has exited.
If a native-authored project's recovery was interrupted and its pool stopped,
hack ps reports the stopped pool and pending recovery. In JSON,
status is runtime_not_running, recovery_pending is true, and items
is empty. Run the printed down --recover command to resume the selected
project and branch. Reading status leaves the pool stopped.
If the foreground owner exited during startup, run the same down --recover
while the original pool is still running. Recovery retains project data and
requires matching records for this run. If it refuses, run hack ps --json:
while the owner is still running or stopping, wait for it to exit and run
down --recover again. If it still refuses after the owner exited, the run
cannot be recovered in this boot. A start that failed or never finished, or an
owner that died during its own stop, keeps its data in this home, and the
explicit dead-owner cleanup
recovers it across a pool stop. That cleanup does not cover an owner that died
while restoring or restarting a retained run; keep the home and its receipts.
After a recovery that completed, hack ps reports not_started until
the next up.
If stop reports retained or unknown cleanup, follow its inspection instructions before switching. Keep the home and receipts; use the cleanup reference.
If startup was interrupted just after creating a container, cleanup records
the container it verified before removing it. Once cleanup finishes with data
retained, hack up can restore the run with its existing named volumes.
This applies when cleanup records the ID. Runs already stopped with a missing
container ID still refuse restore. Earlier builds cannot read receipts that
contain the new cleanup observation field.
With a manager that supports shared homes, stop the project and pool, then
upgrade normally. The new bundle uses the original home, volumes and run
mapping. On macOS, hack-next --manager status reports native_home.
Upgrade the manager before switching
bundles if your manager still creates a home per release.
When switching between independently installed homes, the project may still
record a run in the other home. In that case, hack up, hack ps and hack down from the new version refuse with
E_NATIVE_RUN_MAPPING_FOREIGN_HOME. When the old home proves a clean stop, the
message names the exact command that releases the old mapping
(hack doctor --native-run-mapping release --expect-selection <sha> [--branch <name>]);
run it, then hack up again. The project's data stays in the old home. If the old
run is still live or its stop cannot be proven, stop it with the old version first.
If the old home is no longer at its path (deleted, or on a disk that is not
mounted), its records cannot be read there. The same refusal then names the same
release command: it releases the mapping once no process of this user still names
the old home's path or works inside it, and keeps the mapping in an audit file
beside it. If the home is on a disk that is not mounted (the message names a missing
directory under /Volumes, /mnt or /media when it can tell), mount it and stop
the run there instead; its data is still on that disk. A home that was moved rather
than deleted, and started again from its new path, has processes that name only the
new path, so this check cannot see it; in that case release again from the moved
home afterwards.
Back to Compose
After hack down confirms the native project has stopped, switch its setting:
hack config set --path /absolute/project runtime.engine compose
hack up --detach --path /absolute/projectNative data stays in the native home. Compose uses its own volumes and images.
The command contract and full reference cover advanced configuration and recovery.
Read the startup timeline
Run hack up --detach --timings to see the native startup timeline on stderr.
It shows when every container started and when all services met their readiness
conditions. A service with a health check must pass it. A completed one-shot
service must exit successfully. A milestone appears only when this invocation
observed it. A project that is still warming may have a start time without a
readiness time.
Native hack up --json includes the same hack.timings/1 records
in data.timings. Add --timings-file <file> to save those records as JSONL
in a new file. Times overlap when steps run together, so use command.total
for elapsed startup time.
Native hack down and hack ps accept the same two flags. --timings prints
the command's timeline to stderr, so a --json result on stdout is unchanged.
--timings-file <file> saves the joined hack.timings/1 records as JSONL.