Skip to content

Hardware

The information refer to the available hardware of the device

Available information

On macOS target 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

API source

The information are retrievable using the MacOsInfo.hardware API:

Retrieve a MacOsInfo instance before accessing the hardware information

Hardware API

Retrieve a MacOsHardware instance from macOsInfo instance

val hardware: MacOsHardware = macOsInfo.hardware

Properties

The below properties are readable properties provided by the hardware instance

Reading a hardware property retrieves a new snapshot of the corresponding information. Read the property again to retrieve updated information

computerSystem

The computer system identity, firmware, and baseboard information

val computerSystem: MacOsComputerSystem = hardware.computerSystem

println(computerSystem)

processorInfo

The central processor identity, topology, frequencies, caches, and CPU load ticks

val processorInfo: MacOsCentralProcessor = hardware.processorInfo

println(processorInfo)

globalMemory

The global memory information, including virtual and physical memory

val globalMemory: MacOsGlobalMemory = hardware.globalMemory

println(globalMemory)

powerSourceDescription

The internal power source capacity, electrical measurements, and charging state

val powerSourceDescription: MacOsPowerSource = hardware.powerSourceDescription

println(powerSourceDescription)

Warning

Reading powerSourceDescription throws an IllegalStateException when the internal battery service is unavailable

disks

List of physical and synthesized disks with their I/O statistics and associated partitions

val disks: List<MacOsHWDiskStore> = hardware.disks

println(disks)

networkInterfaces

List of network interfaces with their identities, assigned addresses, and traffic statistics

val networkInterfaces: List<MacOsNetworkIF> = hardware.networkInterfaces

println(networkInterfaces)

displaysInfo

List of available display identification information

val displaysInfo: List<MacOsDisplayInfo> = hardware.displaysInfo

println(displaysInfo)

usbDevices

List of USB devices with their nested connected devices

val usbDevices: List<MacOsUsbDevice> = hardware.usbDevices

println(usbDevices)

bluetoothDevices

List of Bluetooth devices paired with the system, including disconnected devices

val bluetoothDevices: List<MacOsBluetoothDevice> = hardware.bluetoothDevices

println(bluetoothDevices)

The connected property indicates whether a device is currently connected. A batteryLevel of -1 indicates that a battery reading is unavailable

printers

List of printers configured on the system

val printers: List<MacOsPrinter> = hardware.printers

println(printers)

soundCards

List of sound cards with their names, driver versions, and codec descriptions

val soundCards: List<MacOsSoundCard> = hardware.soundCards

println(soundCards)

graphicCards

List of graphics cards with their identities, hardware revisions, and video-memory values

val graphicCards: List<MacOsGraphicsCard> = hardware.graphicCards

println(graphicCards)