Skip to content

Overview

The information refer to the device on the native macOS target

Available information

Hardware

The available hardware information are the below:

Category Property Description Source
Computer System computerSystem The details of the computer system, firmware, and baseboard MacOsHardware.computerSystem
CPU processorInfo The details of the system's central processor (CPU) MacOsHardware.processorInfo
Memory globalMemory The details about the system's global, virtual, and physical memory MacOsHardware.globalMemory
Power Source powerSourceDescription The capacity, electrical measurements, and charging state of the internal battery MacOsHardware.powerSourceDescription
Disk Storage disks A list of physical and synthesized disks with their partitions MacOsHardware.disks
Network Interfaces networkInterfaces A list of network interfaces, their addresses, and traffic statistics MacOsHardware.networkInterfaces
Displays displaysInfo A list of available display identification information MacOsHardware.displaysInfo
USB Devices usbDevices A list of USB devices with their nested connected devices MacOsHardware.usbDevices
Bluetooth Devices bluetoothDevices A list of Bluetooth devices paired with the system MacOsHardware.bluetoothDevices
Printers printers A list of printing destinations configured on the system MacOsHardware.printers
Sound Cards soundCards A list of audio devices available on the system MacOsHardware.soundCards
Graphics Cards graphicCards A list of graphics cards available on the system MacOsHardware.graphicCards

Operating system

The available operating system information are the below:

Category Property Description Source
OS Info operatingSystemVersion The version, code name, and build number of macOS MacOsOperatingSystem.operatingSystemVersion
File Store statfs The file store information for the root filesystem (/) MacOsOperatingSystem.statfs
Desktop Windows visibleWindows A list of desktop windows currently reported as on-screen MacOsOperatingSystem.visibleWindows
Desktop Windows allWindows A list of all desktop windows returned by the native enumeration MacOsOperatingSystem.allWindows
User Session utmpx The first active user session found in the native records MacOsOperatingSystem.utmpx
Process Info procTaskAllInfo The current process and its thread information MacOsOperatingSystem.procTaskAllInfo
IP Connections socketFdInfo A list of accessible IP connections MacOsOperatingSystem.socketFdInfo
IP Routes rtMsgHdr2 A list of IP routes from the native routing table MacOsOperatingSystem.rtMsgHdr2
TCP Stats tcpStat The native TCP statistics MacOsOperatingSystem.tcpStat
UDP Stats udpStat The native UDP statistics MacOsOperatingSystem.udpStat

API source

The information are retrievable using the MacOsInfo API:

Composable context

Retrieve a KInfoState instance inside composable context

val kInfoState = rememberKInfoState()

Non-composable context

Retrieve a KInfoState instance inside non-composable context

val kInfoState = KInfoState()

MacOsInfo

Retrieve a MacOsInfo instance from kInfoState instance

val macOsInfo = kInfoState.macOsInfo

Warning

You can directly retrieve macOsInfo inside the macosMain source set. In commonMain, use the onMacOs callback shown in the common usage instead. Accessing macOsInfo on another platform throws an exception