Skip to content

Operating system

The information refer to the operating system of the device

Available information

On macOS target 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.operatingSystem API:

Retrieve a MacOsInfo instance before accessing the operating system information

OperatingSystem API

Retrieve a MacOsOperatingSystem instance from macOsInfo instance

val operatingSystem: MacOsOperatingSystem = macOsInfo.operatingSystem

Properties

The below properties are readable properties provided by the operatingSystem instance

Read an operating system property again to request updated information. Separate property reads query their data independently

operatingSystemVersion

The version information of the current macOS operating system

val operatingSystemVersion: MacOsVersionInfo = operatingSystem.operatingSystemVersion

println(operatingSystemVersion)

statfs

The file store information for the root filesystem (/)

val statfs: MacOsFileStore = operatingSystem.statfs

println(statfs)

Warning

Reading statfs throws an IllegalStateException when the root filesystem information cannot be read

visibleWindows

List of desktop windows currently reported as on-screen

val visibleWindows: List<MacOsDesktopWindow> = operatingSystem.visibleWindows

println(visibleWindows)

allWindows

List of desktop windows returned by the native enumeration, including windows that are not on-screen

val allWindows: List<MacOsDesktopWindow> = operatingSystem.allWindows

println(allWindows)

utmpx

The first active user session found in the native utmpx records

val utmpx: MacOsOsSession = operatingSystem.utmpx

println(utmpx)

Warning

Reading utmpx throws an IllegalStateException when no active user session can be read

procTaskAllInfo

The current process running the application. Its threads are available through threadDetails

val procTaskAllInfo: MacOsOSProcess = operatingSystem.procTaskAllInfo

println(procTaskAllInfo)

socketFdInfo

List of IP connections from socket descriptors accessible to the application

val socketFdInfo: List<MacOsIPConnection> = operatingSystem.socketFdInfo

println(socketFdInfo)

Socket descriptors whose information cannot be read or mapped are omitted from the list

rtMsgHdr2

List of IP routes read from the native routing table

val rtMsgHdr2: List<MacOsIpRoute> = operatingSystem.rtMsgHdr2

println(rtMsgHdr2)

tcpStat

The native TCP statistics

val tcpStat: MacOsTcpStats = operatingSystem.tcpStat

println(tcpStat)

Reading tcpStat throws an IllegalStateException when the native statistics query fails

udpStat

The native UDP statistics

val udpStat: MacOsUdpStats = operatingSystem.udpStat

println(udpStat)

Reading udpStat throws an IllegalStateException when the native statistics query fails