Build for the Mac
An Angular Native app runs on macOS as a native app: AppKit views drawn by the desktop host, React Native's C++ core and Hermes, with no web view.
EAS Build and EAS Update do not build or update macOS apps. You build a Mac app on a Mac, with
npm run package, and ship new versions of it through Sparkle, which only a dmg packaged with
--feed-url and a public key carries (see Packaging); the
app that npm run package makes has no updater. To build, sign and notarise it on every push,
see Package in GitHub Actions.
Start
A new app that is only for the Mac starts from the desktop template, whose README is its quick start:
npx create-expo-app@latest my-app --template @ng-native/template-desktop
cd my-app
npm start # the dev server, in one terminal
npm run macos # gets the desktop host the first time, then opens the appExpo is the build tool here, not the runtime: its CLI, config, autolinking and Metro build the app, and the desktop host runs it. To add macOS to an app you have, see Desktop setup, which also covers Nx and the Angular CLI.
The template runs on Linux too, with npm run linux on a Linux machine: see
Build for Linux.
Linux
The same app runs on Linux, with GTK 4 and libadwaita views. Build for Linux has the setup and packaging. The distributions the host is checked on:
| Distribution | Checked |
|---|---|
| Ubuntu 24.04 and 26.04 | launched every night in CI |
| Debian 13 | launched every night in CI |
| Fedora 44 and 45 | launched every night in CI |
| RHEL 9 and its rebuilds | the host is built on AlmaLinux 9 on every pull request (GTK 4.12, libadwaita 1.4) |
The floor is GTK 4.10 and libadwaita 1.4 with glibc 2.34. A deb is made for Debian 13 and Ubuntu
24.04 or later, an rpm for Fedora and the RHEL family 9 or later, and a Flatpak brings its own
runtime.
What a Mac app has
- Windows. The root component renders in the main window, and
AppWindowsopens more: a component in each, or a named outlet of the app's one Router. See Windows. - Menus. Every app gets the standard menu bar.
<menu-bar>,<menu-group>and<menu-item>add to it,[contextMenu]gives a view a menu on a secondary click,[menu]gives a<pressable>one on a click, and[shortcut]a key. See Menus. - A sidebar.
<split-view>,<sidebar>,<sidebar-section>and<sidebar-item>are the window's source list, and a tab app's tabs become one. See Sidebar. - The mouse and keyboard.
:hover,:focus-visible,cursor,(mouseenter),(dblclick),(contextmenu)and Tab order all work, and<native-button>is an AppKit button. - Drag and drop.
(fileDrop)takes files, text and urls dragged onto a view, and[dragItem]lets a view be dragged out. See Drag and drop. - The system. The Dock and a menu bar icon, declared programs, urls and files through Processes and Shell, and the app's own actions on Edit > Undo through UndoStack.
The pages under this one cover what differs from iOS and Android, how big things are on a Mac, where each desktop API is imported from, what each OS has, and how Electron's APIs map to these.
Test it
render(X, { os: 'macos' }) renders a component as on macOS, in its main window, with recording
fakes of the windows, menus, Dock and tray. See
Testing on another OS.
An app from the desktop template, or from the generators' desktop-only option, has a Vitest
project for each OS in Node and one for each inside the app. node-macos and node-linux run in
Node, and are what npm test (vitest run --project node-macos --project node-linux) and the
app's test target run. macos runs src/**/*.device.ts, such as src/app/app.device.ts,
inside the app on real AppKit views, and starts Metro and opens the app itself; linux does the
same in GTK (see Test Linux from a Mac):
npx vitest --project macos