Command line utility for interacting with Apple's Private (Closed) Mobile Device Framework
Command line utility for interacting with Apple's Private (Closed) Mobile Device Framework
mobiledevice is a command line utility for interacting with Apple's Private Mobile Device Framework. It can be used for automating some tasks like installing and uninstalling apps on your iPhone/iPad without having to manually do it via Xcode or iTunes. You don't need a jailbroken device!
If you use homebrew, you can install mobiledevice by executing:
brew update
brew install mobiledeviceTo compile mobiledevice, open a terminal console and type:
git clone git://github.com/imkira/mobiledevice.git
cd mobiledevice
makeTo install mobiledevice in your system, proceed with:
make installAfter compiling/installing mobiledevice, open a terminal console.
For the usage screen, you can type
mobiledevice helpand the following will be displayed:
…On failure, all commands exit with status code set to a non-zero value, and some print messages to stderr indicating the kind of error.
On success, all commands exit with status code set to 0.
To list all connected devices, you can type
mobiledevice list_devicesAnd all devices will be listed by UDID like the following:
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
7c211433f02071597741e6ff5a8ea34789abbf43
0ab8318acaf6e678dd02e2b5c343ed41111b393dIn the previous example, there are 3 connected devices.
If you want to limit the number of results you can pass the -n
flag as follows:
mobiledevice list_devices -n 1The output will be, as expected, trimmed to one device.
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434dTo list all properties about a device, you can type:
mobiledevice list_device_propsThe output should be something like:
ActivationPublicKey
ActivationState
ActivationStateAcknowledged
BasebandSerialNumber
BasebandStatus
BasebandVersion
BluetoothAddress
BuildVersion
CPUArchitecture
DeviceCertificate
DeviceClass
DeviceColor
DeviceName
DevicePublicKey
DieID
...To specify a different device, you can also append the -u flag as
follows:
mobiledevice list_device_props -u 7c211433f02071597741e6ff5a8ea34789abbf43Notes:
-u is not provided, the first detect device will be used.To display the value of a device property with a given name, you can type:
mobiledevice get_device_prop property_nameFor example to get information on the product type of the device, you can use ProductType as property name:
mobiledevice get_device_prop ProductTypeTo specify a different device, you can also append the -u flag as
follows:
mobiledevice get_device_prop -u 7c211433f02071597741e6ff5a8ea34789abbf43
property_nameNotes:
-u is not provided, the first detect device will be used.To get the list of installed apps, type:
mobiledevice list_appsThe output should be something like:
com.apple.VoiceMemos
com.apple.mobiletimer
com.apple.AdSheetPhone
com.apple.weather
com.apple.iphoneos.iPodOut
com.apple.mobilesafari
com.apple.Preferences
...
com.mycompany.myapp1
com.mycompany.myapp2
...To specify a different device, you can also append the -u flag as
follows:
mobiledevice list_apps -u 7c211433f02071597741e6ff5a8ea34789abbf43Notes:
-u is not provided, the first detect device will be used.To display the value of a device property with a given name, you can type:
mobiledevice list_app_props com.mycompany.myappThe output should be something like:
SBIconClass
CFBundleInfoDictionaryVersion
Entitlements
DTPlatformVersion
CFBundleName
DTSDKName
ApplicationType
UIViewControllerBasedStatusBarAppearance
CFBundleIcons
UIStatusBarStyle
Container
LSRequiresIPhoneOS
CFBundleDisplayName
PrivateURLSchemes
UIBackgroundModes
DTSDKBuild
...To specify a different device, you can also append the -u flag as
follows:
mobiledevice list_app_props -u 7c211433f02071597741e6ff5a8ea34789abbf43 com.mycompany.myappNotes:
-u is not provided, the first detect device will be used.To display the value of an application property with a given name, you can type:
mobiledevice get_app_prop com.mycompany.myapp property_nameFor example to get the path where Apple's Weather app is installed on the device, you can use Path as property name:
mobiledevice get_app_prop com.apple.weather PathTo specify a different device, you can also append the -u flag as
follows:
mobiledevice get_app_prop -u 7c211433f02071597741e6ff5a8ea34789abbf43 com.mycompany.myapp PathNotes:
-u is not provided, the first detect device will be used.To install an app on the device, you can type:
mobiledevice install_app path/to/my_application.appTo specify a different device, you can also append the -u flag as
follows:
mobiledevice install_app -u 7c211433f02071597741e6ff5a8ea34789abbf43 path/to/my_application.appNotes:
-u is not provided, the first detect device will be used.To uninstall an app from the device, pass in the bundle identifier and type:
mobiledevice uninstall_app com.mycompany.myappTo specify a different device, you can also append the -u flag as
follows:
mobiledevice uninstall_app -u 7c211433f02071597741e6ff5a8ea34789abbf43 com.mycompany.myappNotes:
-u is not provided, the first detect device will be used.If your app creates a TCP server by listening on some port, it may be useful to connect to it via USB (no need for WiFi/3G connection). mobiledevice allows you to create a tunnel between your Mac and your device, via a USB cable. If you connect to your Mac (on localhost or 127.0.0.1) mobiledevice will forward that connection to the device on the specified port by typing something like:
mobiledevice tunnel 8080 80The previous example attempts to illustrate a tunnel between your Mac's TCP port 8080 and the device's TCP port 80. The output would be something like:
Tunneling from local port 8080 to device port 80...From this point you can telnet localhost 8080 and communicate with the server
running at TCP port 80 on the mobile app!
To specify a different device, you can also append the -u flag as
follows:
mobiledevice tunnel -u 7c211433f02071597741e6ff5a8ea34789abbf43 8080 80Notes:
-u is not provided, the first detect device will be used.This is just an utility command, and is not related to the MobileDevice Framework. To get the bundle identifier (e.g. com.mycompany.myapp) of an .app you can type the following command (bear in mind it must be a valid .app folder, not a .ipa!):
mobiledevice get_bundle_id path/to/my_application.appNotes:
Found a bug? Want to contribute and add a new feature?
Please fork this project and send me a pull request!
You can check the full list here.
mobiledevice is licensed under the MIT license:
No open issues yet, or sync has not completed.