2 unstable releases

0.2.0 Jan 30, 2023
0.1.3 Jul 23, 2022
0.1.2 Jul 23, 2022

#156 in macOS and iOS APIs

Download history 9801/week @ 2024-03-14 12212/week @ 2024-03-21 11905/week @ 2024-03-28 12763/week @ 2024-04-04 11907/week @ 2024-04-11 11426/week @ 2024-04-18 11112/week @ 2024-04-25 10046/week @ 2024-05-02 7760/week @ 2024-05-09 6784/week @ 2024-05-16 6116/week @ 2024-05-23 6129/week @ 2024-05-30 4877/week @ 2024-06-06 5355/week @ 2024-06-13 5212/week @ 2024-06-20 4564/week @ 2024-06-27

20,898 downloads per month
Used in 6 crates (via apple-sys)


341 lines


Apple platforms have a rather monotonous programming environment compared to other platforms. On several development machines, we will dependably obtain the same bindgen result. Then why not simply having bindgen configurations for the frameworks?

How to use?

To add CoreFoundation and IOKit, try to run:

$ cargo add apple-sys --features=CoreFoundation,IOKit

If you are using older version of cargo, try to add to Cargo.toml:

apple-sys = { version = "*", features=["CoreFoundation", "IOKit"] }

The names of the features and the frameworks are same. To see the full list, check the project’s features in the Cargo.toml file.

The feature names are the module names. Everything is single-depth. There are no nested modules.

use apple_sys::{CoreFoundation, IOKit};

// CoreFoundation::<any name>
// IOKit::<any name>


The bindgen tool is installable and generating the same result to apple-sys crates. To create a new -sys project, starting with apple-bindgen result will be a convenient way.


$ cargo install apple-bindgen

To generate CoreFoundation bindings,

$ apple-bindgen CoreFoundation --sdk macosx

To generate UIKit bindings for iOS,

$ apple-bindgen UIKit --sdk iphoneos

Why apple-sys?

apple-sys contains auto-generated bindgen modules for Apple platforms. As long as we use the same versions of SDKs and bindgen, the result will be reproducible.

Why not apple-sys?

Continually using the same SDKs doesn't sound realistic. I agree. Don’t trust apple-sys. Use the managed versions as best you can. For CoreFoundation, for instance, use core-foundation-sys.

Then why do I use apple-sys? I created apple-sys for minor and unmanaged frameworks. apple-sys will be the last fallback.


There are no plans for apple-sys to distribute generated or manually changed code. We shall just manage bindgen rules. Look in the project root directory's "bindgen/Bindgen.toml" file.


~145K SLoC