fitzgen
mach
Rust

A rust interface to the Mach 3.0 kernel that underlies OSX.

Last updated Jun 29, 2026
92
Stars
29
Forks
8
Issues
+1
Stars/day
Attention Score
20
Language breakdown
No language data available.
โ–ธ Files click to expand
README

[![Build Status][traviscibadge]][travis_ci] [![Latest Version]][crates.io] [![docs]][docs.rs]

A Rust interface to the user-space API of the Mach 3.0 kernel exposed in /usr/include/mach that underlies macOS and is linked via libSystem (and libsystem_kernel).

This library does not expose the kernel-space API of the Mach 3.0 kernel exposed in SDK/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach.

That is, if you are writing a kernel-resident device drivers or some other kernel extensions you have to use something else. The user-space kernel API is often API-incompatible with the kernel space one, and even in the cases where they match, they are sometimes ABI incompatible such that using this library would have undefined behavior.

Usage

Add the following to your Cargo.toml to conditionally include mach on those platforms that support it.

[target.'cfg(any(targetos = "macos", targetos = "ios"))'.dependencies.mach]
version = "0.3"

The following crate features are available:

  • deprecated (disabled by default): exposes deprecated APIs that have been
removed from the latest versions of the MacOS SDKs. The behavior of using these APIs on MacOS versions that do not support them is undefined (hopefully a linker error).

Platform support

The following table describes the current CI set-up:

| Target | Min. Rust | XCode | build | ctest | run | |-----------------------|-----------|---------------|-------|-------|-----| | x86_64-apple-darwin | 1.33.0 | 6.4 - 10.0 | โœ“ | โœ“ | โœ“ | | i686-apple-darwin | 1.33.0 | 6.4 - 10.0 | โœ“ | โœ“ | โœ“ | | i386-apple-ios | 1.33.0 | 6.4 - 9.4 [0] | โœ“ | - | - | | x86_64-apple-ios | 1.33.0 | 6.4 - 10.0 | โœ“ | - | - | | armv7-apple-ios | nightly | 6.4 - 10.0 | โœ“ | - | - | | aarch64-apple-ios | nightly | 6.4 - 10.0 | โœ“ | - | - |

[0] i386-apple-ios is deprecated in XCode 10.0.

License

This project is licensed under either of

http://www.apache.org/licenses/LICENSE-2.0) http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in mach by you, as defined in the Apache-2.0 license, shall be triple licensed as above, without any additional terms or conditions.

To locally test the library, run:

TARGET=x8664-apple-darwin TRAVISRUST_VERSION=nightly ./ci/run.sh

where you can replace the TARGET and TRAVISRUSTVERSION with the target you want to test (e.g. i686-apple-darwin) and the Rust version you want to use for the tests (e.g. stable, 1.33.0, etc.).

[travis_ci]: https://travis-ci.org/fitzgen/mach [traviscibadge]: https://travis-ci.org/fitzgen/mach.png?branch=master [crates.io]: https://crates.io/crates/mach [Latest Version]: https://img.shields.io/crates/v/mach.svg [docs]: https://docs.rs/mach/badge.svg [docs.rs]: https://docs.rs/mach/

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท fitzgen/mach ยท Updated daily from GitHub