# Build OSMates from source

Clone the OSMates repository, build its programs, and run the checks that CI runs.

To use OSMates, [download the official app](https://osmates.com/download). A build of your own compiles and passes the checks, but it can't run machines yet.

## Get the tools

You need a Mac with Apple silicon and macOS 27, Xcode 27.1 or later, [rustup](https://rustup.rs), [Homebrew](https://brew.sh), and up to 30 GB of free disk.

To install the libraries and tools the build uses:

```sh
brew install autoconf automake libtool meson ninja cmake pkgconf python@3.14 llvm spirv-llvm-translator spirv-tools
xcodebuild -downloadComponent MetalToolchain
```

## Build and check

1. Clone the repository:

   ```sh
   git clone https://github.com/osmates/osmates.git
   cd osmates
   ```

2. Run lint and the unit tests:

   ```sh
   make check
   ```

   The first run also builds libtpms and the renderer for accelerated Linux guests. The renderer fetches and builds ANGLE, the longest step, and later runs reuse both.

3. Build every program without signing, as CI does:

   ```sh
   make build XCODEBUILD_FLAGS=CODE_SIGNING_ALLOWED=NO
   ```

The app is then in `.build/xcode/Build/Products/Debug/OSMates.app`. [Building](https://github.com/osmates/osmates/blob/c3cf438e1cd234735e32f18c0f168d8e6f98009a/docs/development/building.md) lists the other make targets.

## Share a build

The MIT License covers the code, not the OSMates name or icon. A build you give to others needs a name and icon of its own, as the [trademark policy](https://osmates.com/trademarks) explains.

## Limits

- A build of your own can't run machines. Its programs lack the virtualization and hypervisor entitlements, and only the OSMates team can sign the worker for now. [Signing](https://github.com/osmates/osmates/blob/c3cf438e1cd234735e32f18c0f168d8e6f98009a/docs/development/setup.md#signing) says what's missing.
- A build from source has no account sign-in, and never checks for updates.
- Pro is a private package that only the official app carries. Without it, a build runs everything before OSMates 1.0, and runs as Free from 1.0.

## If a build fails

[Troubleshoot a development build](https://github.com/osmates/osmates/blob/c3cf438e1cd234735e32f18c0f168d8e6f98009a/docs/development/troubleshooting.md) covers a rebuilt app that doesn't match the background service already running.

If `make check` or `make build` fails on a fresh clone of `main`, open an [issue](https://github.com/osmates/osmates/issues/new/choose). For a question about your setup, ask in `#osmates-feedback` on [Discord](https://osmates.com/discord). Include the command and the last lines it printed.
