View iOS logs using libimobiledevice
Libimobiledevice is a cross-platform open-source software library written in C, designed to communicate with iOS devices natively. It enables interaction with various native device service APIs to manage apps, backup, filesystem, debugging, activation, provisioning,
To view iOS logs using libimobiledevice, you can use the idevicesyslog command. First, install libimobiledevice using homebrew with the following commands:
Install
brew install libimobiledevice
Unpair & Pair
Plugin the iPhone and pair it (unpairing just before you try to pair the very first time is a good idea).
idevicepair unpair
idevicepair pair
In your code add logs
Here an example in C#
In your code, add the log you would like to see. In the example below, I want to log out the value of an integer variable called index
Console.Out.WriteLine("custom-log-tag - index: " + index);
View the logs in your console
Once installed, plug in a paired device, unlock it, and use the following command to view the logs on the screen:
idevicesyslog
If you're interested in capturing specific iPhone app logs, you can use the idevicesyslog command with grep to filter the logs. For example, you can use:
idevicesyslog | grep custom-log-tag
It's also worth noting that Apple Configurator and Xcode provide graphical interfaces to pull logs and other information from iOS devices, but if you prefer to use the terminal, libimobiledevice is a useful tool for this purpose.
Dimitri Missoh | 2024-02-02