HeadlinesBriefing favicon HeadlinesBriefing.com

Apple Launches Container Machine for Seamless Linux on macOS

Hacker News •
×

Apple's new Container Machine tool delivers a lightweight Linux environment that runs natively on macOS. It mounts the user’s home directory, allowing developers to edit code on macOS while compiling inside a Linux container. The tool leverages standard OCI images and keeps state persistent across restarts for continuous development cycles.

Container Machines expose a full init system, so services like PostgreSQL can run under systemd. Developers can test across multiple distros—Alpine, Ubuntu, Debian—while sharing the same $HOME and dotfiles. Switching CPUs or memory is as simple as a single CLI command, with changes applied after a restart for local environments.

Users create machines with a single command: `container machine create alpine:latest --name dev`. After creation, `container machine run -n dev` opens an interactive shell that mirrors the host user. The same directory tree appears under /Users/<name> inside the container, so file edits stay in sync without manual copying between systems.

Advanced users can supply custom init images; a sample Dockerfile builds Ubuntu 24.04 with systemd and common tools. On first boot, a built‑in script provisions the user, but developers may replace it with a custom /etc/machine/create-user.sh. This flexibility lets teams tailor the environment to their workflow for continuous integration testing.