#mac #system #cpu #info #sysctl

bin+lib mac-sys-info

CLI + Library to get detailed information about your Mac system. Including CPU, Cache (L1-L3), Memory, and more.

13 releases

0.1.13 Jan 10, 2021
0.1.12 Dec 1, 2020
0.1.11 Nov 30, 2020

#15 in macOS APIs

Download history 156/week @ 2020-11-25 47/week @ 2020-12-02 52/week @ 2020-12-09 1/week @ 2020-12-16 1/week @ 2020-12-30 18/week @ 2021-01-06 21/week @ 2021-01-13

86 downloads per month

MIT license



CLI + Library to get detailed information about your Mac system. Including CPU, Cache (L1, L2, L3), Memory, and more. The library is a wrapper around all information that the $ sysctl -a command outputs on Mac. It gives you structured access to it as well as raw access to all keys obtained from $ sysctl -a.

Usage as Lib or as CLI

As Library


mac-sys-info = "<insert latest version>"


use mac_sys_info::get_mac_sys_info;
use mac_sys_info::generated_sysctl_keys::SysctlKey;

fn main() {
    // get struct with all information
    let info = get_mac_sys_info().unwrap();
    // even if IDE shows that the Display trait is missing:
    // it is there. It gets implemented during compile time
    // by "derive_macro" crate.
    println!("{}", info.cpu_info());
    println!("{}", info.cpu_info().cache_info());
    // ...
    println!("CPU @ {} Ghz", info.cpu_info().frequency_ghz());
    // IMPORTANT: Raw Access to all SysctlKeys is
    // available! Keys are located in enum `SysctlKey`
    println!("L3 Cache size extracted manually: {}",
    // Some convenient getters.
    println!("L2 Cache Size in KB: {}",
    println!("System has {} GB of RAM", info.mem_info().total_memory_mb())

Run/install as CLI

$ cargo install mac-sys-info
$ mac-sys-info      # simple
$ mac-sys-info -h   # help
$ mac-sys-info -c   # complex
$ mac-sys-info -r   # raw

Example output

    name     : Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    arch     : X86_64
    cores    : 4
    frequency: 2.7 GHz
    L1D-Cache: 32KB
    L1I-Cache: 32KB
    L2-Cache : 256KB
    L3-Cache : 3072KB

    total: 8192MB

    version: 10.15.7
    kernel : Darwin Kernel Version 19.6.0Thu Oct 29 225645 PDT 2020; rootxnu-6153.141.2.2~1/RELEASE_X86_64

Why another tool?

There is already a popular crate called sys-info, that's true. But it doesn't show information about the size of L1 cache, or cache in general. I need this information for a task I'm working on. Therefore I created this crate. It was also fun and as always I learned new stuff. :)


MIT License. See "LICENSE" file in repository.


~75K SLoC