{"canonical_url":"https://engineer.company/glossary/macos/","content_markdown":"# macOS\n\n## What it is\n\nmacOS is the operating system Apple ships on every Mac: the desktop and the\nFinder, the bundled apps, and underneath them a Unix system with a terminal, a\nshell and the familiar command-line tools. Apple builds it for its own hardware\nand sells the two together, so in practice choosing macOS means choosing a Mac.\n\nThe core is Darwin, whose source Apple publishes. Its kernel, XNU, is a hybrid\nthat joins the Mach kernel from Carnegie Mellon University with code taken from\nFreeBSD and with IOKit, a C++ framework for drivers; the name stands for “X is\nNot Unix”. Much of the userland comes from FreeBSD too, and the manual pages for\n`sed` and `date` on a Mac describe FreeBSD's versions of those tools. Since\nmacOS 10.15 Catalina the default shell has been zsh.\n\nThe hardware changed under it recently. In late 2020 Apple began moving the Mac\nfrom Intel processors to its own chips, Apple silicon, and every Mac line from\nthe MacBook Air to the Mac Pro now has Apple silicon models. Those chips are\narm64, which matters the moment software built on a Mac has to run on an x86-64\nserver.\n\nOn laptops and desktops macOS is weighed against Windows and Linux.\n\n## Why it matters\n\nFor a company that writes software, macOS plays two parts that are easy to blur:\nit is the machine many developers work on, and it is a platform customers run\nsoftware on.\n\nAs a workstation, a Mac differs from the Linux servers it deploys to in three\nplaces. Its command-line tools come from FreeBSD rather than GNU, so the same\nflag can mean different things in a script. Its processor is arm64 where the\nserver may be x86-64. And it has no Linux kernel, while Linux containers share\nthe kernel of their host, so tools running them on a Mac start a Linux virtual\nmachine first; Apple's own `container` tool, which needs Apple silicon and\nmacOS 26, gives each container a lightweight virtual machine of its own. None\nof this rules a Mac out; it means testing on the system you deploy to rather\nthan trusting a green run on a laptop.\n\nAs a platform, macOS raises the question of how to build for it. A\ncross-platform shell, one codebase with an embedded browser engine shipped for\nWindows, Linux and the Mac, keeps several systems in step cheaply, but on the\nMac it carries a browser runtime a native application has no use for and draws\nits own controls instead of the system's. A native application in Swift and\nSwiftUI uses the system's controls and materials, and follows the user's\nsettings for appearance, accent colour, contrast, text size and reduced motion\nwithout extra code. The price is a separate client and people who know the\nplatform. Native pays off when Mac users are the customers.\n\nShipping to Macs also passes through a gate. Software distributed outside the\nMac App Store is signed with a Developer ID certificate and sent to Apple's\nnotary service, an automated scan for malicious content and code-signing\nproblems that is separate from App Review. Since macOS 10.15, all software built\nafter 1 June 2019 and distributed with Developer ID must be notarised. Apple\nreturns a ticket to staple to the software and publishes the same ticket online,\nwhere Gatekeeper looks for it when the user first opens the app. The certificate\ncomes with the Apple Developer Program, at $99 a year. Plan the membership and\nthe signing step into the first release.\n\n## What it looks like in practice\n\nThe desktop experience of one messaging product on macOS was a cross-platform\nshell that neither looked nor behaved like a Mac application. Its well-tested\nRust core exposes a C interface, and Swift can call C, so\n[a native client in Swift and SwiftUI](/portfolio/built-a-native-macos-client-in-swift-6/)\nwas built directly on that interface. The core is linked in as a static archive\nfrom a pinned upstream revision, which keeps the build reproducible, and a thin\nwrapper owns every pointer that crosses between the languages. The client starts\nas a Mac application, uses the platform's own materials and controls, and\ncarries no embedded browser. The page is frank about the gap: there is no\nnotarised distribution and no update channel, so it is a working application\nrather than a product other people run. The notary step above is what stands\nbetween the two.\n\nThe platform's look can be enforced rather than imitated.\n[A design system of 48 named tokens](/portfolio/built-a-48-token-macos-design-system/)\nin six groups builds colour and material on the platform's semantic colours and\nglass material instead of fixed values, so the interface follows the system\nappearance, the accent colour and the contrast settings with no code watching\nfor them, and its text styles scale with the user's size preference. A linter\nrejects a raw number where a token belongs, a hardcoded font size, and an\nanimation that ignores the reduce-motion preference. The page names its limit\ntoo: tokens make an interface consistent, which is different from making it\ngood.\n\nCompressed memory and swap let a macOS app grow far past the machine's physical memory.\n[One incident record](/portfolio/an-app-that-ate-41-mb-a-second-stopped/)\ndocuments diagnostic reports of 111 GB of compressed pages on a 36 GB machine on 2026-09-01,\nand a separate footprint sample showing growth of about 41 MB per second during a connection\nretry loop. The event path retained core log events in an unbounded main stream and copied\nthem to subscribers that did not use those events. Buffers were bounded, subscriptions\nfiltered by event type and logging given a rate budget. A full test-run comparison recorded\n610,996 core log lines falling to 1,411; these are test-run measurements, not a measured\npost-fix memory figure or a production benchmark. The trade is explicit: repetitive\ndiagnostic events may be dropped, and affected state can be refreshed instead of retaining\nunlimited events. Separate shutdown timeouts needed a separate fix.\n\n## Where it goes wrong\n\n**Activity Monitor shows almost no memory to spare on a Mac that runs perfectly\nwell.** macOS caches recently used files in otherwise unused memory and, as\nmemory fills, compresses inactive apps to make room for active ones, so Memory\nUsed close to Physical Memory and a large Compressed figure are normal. Apple's\nown guidance is that free memory does not necessarily make a Mac faster. Read\nthe Memory Pressure graph instead: green means the RAM is used efficiently,\nyellow that the Mac might eventually need more, red that it needs more. Swap is\nthe plainest signal:\n\n```sh\nsysctl vm.swapusage\nvm_stat | grep -E '^Swap(ins|outs)'\n```\n\nThe `vm_stat` counters run from boot, so compare two readings a minute apart;\nswapouts that keep climbing mean the work has outgrown the RAM.\n\n**A script that works on the Mac stops with an odd error on the Linux server, or\nthe other way round.** The FreeBSD-derived `sed` on a Mac treats the word after\n`-i` as a backup suffix, so the GNU habit `sed -i 's/a/b/' file` takes the\nexpression as the suffix and the file name as the script. The Mac habit\n`sed -i '' …` makes GNU `sed` read the expression as a file name. A suffix\nattached to the flag works on both:\n\n```sh\nsed -i.bak 's/^port=80$/port=8080/' app.conf \u0026\u0026 rm app.conf.bak\n```\n\nThe lasting fix is to run scripts in CI on the system they will meet in\nproduction.\n\n**A build shared outside the team is blocked by Gatekeeper when the recipient\nopens it.** The app was signed for development, or signed but never notarised.\nSign it with a Developer ID certificate, with the hardened runtime enabled and a\nsecure timestamp, send it to the notary service, and staple the ticket so\nGatekeeper finds it even offline. A ZIP archive can be notarised but cannot hold\na ticket, so staple the app inside it:\n\n```sh\nditto -c -k --keepParent App.app App.zip\nxcrun notarytool submit App.zip --keychain-profile notary --wait\nxcrun stapler staple App.app\n```\n\n**A container image runs on the developer's Mac and dies on the server with\n`exec format error`.** Docker builds for the platform of the BuildKit daemon by\ndefault, and on an Apple silicon Mac that daemon runs in an arm64 virtual\nmachine. A container shares the host's kernel, so without emulation an x86-64\nhost runs x86-64 code only. Check the server with `uname -m`, then build for it\nwith `docker build --platform linux/amd64`, or build in CI on a machine with the\nserver's CPU type.\n\n## Further reading\n\n- [Mac User Guide](https://support.apple.com/guide/mac-help/welcome/mac)\n  — Apple's own guide to macOS, kept for each current release.\n- [Check if your Mac needs more RAM](https://support.apple.com/guide/activity-monitor/check-if-your-mac-needs-more-ram-actmntr34865/mac)\n  — the Memory Pressure graph and what its three colours mean.\n- [Notarizing macOS software before distribution](https://developer.apple.com/documentation/security/notarizing-macos-software-before-distribution)\n  — Developer ID, the hardened runtime and how Gatekeeper uses the ticket.\n- [Multi-platform builds](https://docs.docker.com/build/building/multi-platform/)\n  — why arm64 and amd64 hosts need different images, and how one build makes\n  both.\n- [container](https://github.com/apple/container)\n  — Apple's tool for running Linux containers on a Mac, each in a lightweight\n  virtual machine.\n- [XNU](https://github.com/apple-oss-distributions/xnu)\n  — the macOS kernel's source, with a short account of how Mach, FreeBSD and\n  IOKit fit together.\n\n\u003chttps://engineer.company/glossary/macos/\u003e\n","date_modified":"2026-11-09T21:50:25Z","description":"macOS for teams that build on Macs and deploy to Linux: the Unix underneath, native apps against shells, notarisation, and reading memory right.","formats":{"gemtext":"https://engineer.company/glossary/macos/index.gmi","gopher":"https://engineer.company/glossary/macos/gophermap","html":"https://engineer.company/glossary/macos/","json":"https://engineer.company/glossary/macos/index.json","markdown":"https://engineer.company/glossary/macos/index.md","pdf":"https://engineer.company/glossary/macos/index.pdf"},"kind":"page","language":"en","title":"What is macOS?","url":"https://engineer.company/glossary/macos/","version":1}