idevicediagnostics
Retrieve diagnostics from connected iOS devices
TLDR
Print diagnostics information
Print mobilegestalt key values
Shutdown, restart or sleep the device
SYNOPSIS
idevicediagnostics [OPTIONS] COMMAND [ARGUMENTS...]
PARAMETERS
-u, --udid <UDID>
Targets a specific device by its unique 40-digit UDID. If not specified, the command will attempt to connect to the first available device.
-h, --help
Displays a concise usage summary and available commands for idevicediagnostics.
-d, --debug
Enables verbose debug output, useful for troubleshooting connection or command issues.
diagnostics [<MODE>]
Connects to the device's diagnostic interface. The optional <MODE> can be "normal", "basic", "gasgauge", or "nand". If no mode is specified, it defaults to "normal" and provides basic device information.
sleep
Instructs the connected iOS device to enter sleep mode, effectively locking the screen.
restart
Initiates a full restart of the connected iOS device.
shutdown
Commands the connected iOS device to shut down completely.
mobilegestalt <SELECTORS>...
Queries specific MobileGestalt keys from the device. Multiple selectors can be provided as arguments to retrieve various hardware and software properties. For example: ProductType, DeviceClass, ChipID.
query [<QUERY_KEYS>...]
Retrieves specific diagnostic information. Examples of <QUERY_KEYS> include WiFi, Power, Battery. Use --all to query all available diagnostic data.
--all
Used in conjunction with the query command to retrieve all available diagnostic data from the device.
version
Prints the version information of the idevicediagnostics utility.
DESCRIPTION
idevicediagnostics is a command-line utility for interacting with the diagnostics interface of iOS devices. It is part of the libimobiledevice project, an open-source suite of libraries and tools that enable communication with Apple devices on Linux, macOS, and Windows, serving as an alternative to Apple's proprietary MobileDevice framework. This command allows users to query various system information, control device states such as putting the device to sleep, restarting, or shutting it down, and initiating specific diagnostic modes like "gasgauge" or "nand". It's a powerful tool for developers, system administrators, and advanced users who need to perform low-level interactions or gather detailed device information without relying on iTunes or Xcode. Its capabilities range from retrieving basic device properties to detailed hardware and software diagnostics.
CAVEATS
idevicediagnostics requires the target iOS device to be connected via USB and trusted by the host computer (usually confirmed by accepting a "Trust This Computer" prompt on the device). Some operations, particularly restart and shutdown, can interrupt ongoing device operations and should be used with caution. The availability and specific output of diagnostic queries (mobilegestalt, query) can vary depending on the iOS version and device model. Debug mode (-d) can produce a large amount of output, which may be overwhelming for general use but invaluable for debugging.
DIAGNOSTIC MODES EXPLAINED
idevicediagnostics supports specific diagnostic modes through its diagnostics subcommand, allowing for targeted data retrieval:
"normal": The default mode, often used to establish a connection and gather basic device info.
"basic": Provides fundamental diagnostic details.
"gasgauge": Focuses on battery-related diagnostics, including charge cycles, temperature, and current capacity. This is vital for battery health analysis.
"nand": Provides information related to the device's NAND flash storage, useful for assessing storage health and usage.
TRUST RELATIONSHIP
For idevicediagnostics to function, a "trust" relationship must be established between the host computer and the iOS device. This typically involves connecting the device, unlocking it, and tapping "Trust" when prompted on the device's screen. Without this, the device will reject connection attempts from the utility, resulting in errors.
HISTORY
The libimobiledevice project, which includes idevicediagnostics, was initiated to reverse-engineer Apple's proprietary communication protocols for iOS devices. It emerged as a crucial open-source effort to provide Linux and other Unix-like systems with the ability to interact with iPhones, iPads, and iPods without relying on Apple's software. Development has been ongoing for over a decade, with contributions from a global community, continually adapting to new iOS versions and device models to maintain compatibility and extend functionality. This commitment has made libimobiledevice an indispensable toolkit for cross-platform iOS development and management.
SEE ALSO
ideviceinfo(1), ideviceinstaller(1), idevicesyslog(1), idevicebackup2(1), idevicerestore(1)