iOS Device Tools
Install and configure command-line tools for iOS device communication, app deployment, debugging, and dependency management
What are iOS Device Tools?
This guide covers the essential command-line tools for interacting with physical iOS devices. These tools are widely used in mobile automation testing, particularly with Appium, and provide capabilities for device communication, app deployment, web view debugging, and dependency management.
Tools covered:
- libimobiledevice - Cross-platform library for iOS device communication
- ideviceinstaller - App installation and management on iOS devices
- ios-deploy - Deploy and debug iOS apps without Xcode
- ios-webkit-debug-proxy - Chrome DevTools proxy for iOS web view debugging
- Carthage - Decentralized dependency manager for Cocoa projects
Prerequisites
Some tools also require an Apple Developer account for real device testing.
libimobiledevice
libimobiledevice is a cross-platform library for communicating with iOS devices. It provides command-line tools for interacting with iPhones and iPads without requiring iTunes or Xcode.
libimobiledevice is used by Appium for device communication, particularly for real device testing.
Installation
The following brew command is for macOS. Linux and Windows users should consult
the official libimobiledevice documentation or
their distribution’s package manager for platform-specific installation instructions.
brew install libimobiledevice
This installs several command-line utilities:
idevice_id- List attached devicesideviceinfo- Get device informationidevicename- Get or set device nameidevicesyslog- View device system logsidevicescreenshot- Capture screenshotsidevicepair- Manage device pairing
Note:
ideviceinstalleris not included with libimobiledevice. It is a separate Homebrew formula and must be installed separately. See the ideviceinstaller section below.
Verify Your Installation
idevice_id --version
List Connected Devices
idevice_id -l
Get Device Information
Full device info:
ideviceinfo
Specific information:
# Device name
ideviceinfo -k DeviceName
# iOS version
ideviceinfo -k ProductVersion
# Device model
ideviceinfo -k ProductType
# Serial number
ideviceinfo -k SerialNumber
Human-readable format:
ideviceinfo -s
Device Pairing
When you first connect a device, you need to pair it:
idevicepair pair
Tap “Trust” on the iOS device when prompted.
Verify pairing:
idevicepair validate
List paired devices:
idevicepair list
Unpair a device:
idevicepair unpair
View Device Logs
Stream system logs in real-time:
idevicesyslog
Filter by process:
idevicesyslog | grep -i "MyApp"
Save to file:
idevicesyslog > device.log
Take Screenshots
idevicescreenshot screenshot.png
ideviceinstaller
ideviceinstaller is a command-line application to manage apps and app archives on iOS devices. It allows interaction with the app installation service of an iOS device, enabling you to install, uninstall, and manage applications directly from the terminal.
This tool is essential for mobile automation testing with Appium, as it provides the interface for deploying apps to real iOS devices.
Installation
First, reset Xcode’s command line tools selection, then install ideviceinstaller:
# Reset Xcode command line tools
sudo xcode-select -r
# Install ideviceinstaller
brew install ideviceinstaller
Verify Your Installation
ideviceinstaller --version
Common Commands
List installed apps on connected device:
ideviceinstaller -l
Install an app (.ipa file):
ideviceinstaller -i /path/to/app.ipa
Uninstall an app by bundle ID:
ideviceinstaller -U com.example.appname
Working with Multiple Devices
When multiple devices are connected, specify the UDID:
ideviceinstaller -u <device_udid> -i /path/to/app.ipa
Get the UDID with:
idevice_id -l
ios-deploy
ios-deploy is a command-line tool that allows you to install and debug iOS apps on real devices without using Xcode. It’s essential for running Appium tests on physical iOS devices.
ios-deploy is required for Appium testing on real iOS devices. Simulators don’t need it.
Installation
brew install ios-deploy
Verify Your Installation
ios-deploy --version
Usage
Detect connected devices:
ios-deploy --detect
or
ios-deploy -c
Install an app:
ios-deploy --bundle /path/to/MyApp.app
Install and launch:
ios-deploy --bundle /path/to/MyApp.app --debug
Uninstall an app:
ios-deploy --uninstall_only --bundle_id com.example.myapp
List installed apps:
ios-deploy --list_bundle_id
Common Options
| Option | Description |
|---|---|
-c, --detect | List connected devices |
-b, --bundle | Install the specified app bundle |
-d, --debug | Launch app in debug mode after install |
-u, --uninstall_only | Uninstall app by bundle ID |
-L, --list_bundle_id | List installed app bundle IDs |
-W, --no-wifi | Ignore Wi-Fi connected devices |
-i, --id | Target specific device by UDID |
Targeting Specific Devices
When multiple devices are connected:
ios-deploy --id DEVICE_UDID --bundle /path/to/MyApp.app
Get device UDID:
ios-deploy --detect
ios-webkit-debug-proxy
ios-webkit-debug-proxy is a DevTools proxy that implements the Chrome Remote Debugging Protocol for iOS devices. It enables debugging of Safari and web views on real iOS devices using Chrome DevTools.
ios-webkit-debug-proxy is required for Appium testing when your app uses web views (hybrid apps) on real iOS devices. The
startIWDPcapability that previously allowed Appium to manage the proxy automatically is deprecated in Appium 2.x — you must start the proxy manually before running your tests.
Installation
brew install ios-webkit-debug-proxy
Verify Your Installation
ios_webkit_debug_proxy --version
Usage
Start the proxy with default settings:
ios_webkit_debug_proxy
With a specific port:
ios_webkit_debug_proxy -c <device_udid>:9222
Enable Web Inspector on your iOS device:
- Go to Settings > Safari > Advanced
- Enable Web Inspector
Connect Chrome DevTools:
- Start the proxy
- Open Chrome and navigate to
chrome://inspect - Your iOS device should appear under “Remote Target”
- Click “inspect” on the web view you want to debug
Note: Chrome DevTools protocol compatibility may vary between iOS versions and Chrome releases. If you experience issues, try using Safari’s Web Inspector as an alternative for debugging iOS web views.
Configuration Options
# Specify frontend URL
ios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html
# Use specific device
ios_webkit_debug_proxy -c <udid>:9222
# Debug mode for verbose output
ios_webkit_debug_proxy -d
# Specify port range for multiple devices
ios_webkit_debug_proxy -c null:9221,:9222-9322
Appium Integration
For Appium testing with web views on real devices, start the proxy manually before running your tests. Appium will automatically use it for web context switching. Use W3C-compliant namespaced capabilities:
{
"appium:webviewConnectTimeout": 90000,
"appium:nativeWebTap": true
}
Carthage
Carthage is a decentralized dependency manager for Cocoa projects (iOS, macOS). Unlike CocoaPods, Carthage builds your dependencies as frameworks and gives you full control over your project structure.
Note: For new iOS projects, Swift Package Manager (built into Xcode) is the recommended dependency manager. Carthage is still needed for building WebDriverAgent, which Appium uses for iOS automation.
Installation
brew install carthage
Verify Your Installation
carthage version
Basic Usage
Create a Cartfile in your project root:
github "Alamofire/Alamofire" ~> 5.0
github "onevcat/Kingfisher" ~> 7.0
Build for iOS:
carthage update --platform iOS
Build for macOS:
carthage update --platform macOS
Build for all platforms:
carthage update
Use XCFrameworks (pre-built binaries):
carthage update --use-xcframeworks
Cartfile Syntax
Dependency sources:
# GitHub repository
github "owner/repo"
# Git URL
git "https://example.com/repo.git"
# Binary framework
binary "https://example.com/framework.json"
Version requirements:
# Exactly version 1.0
github "owner/repo" == 1.0
# At least version 1.0
github "owner/repo" >= 1.0
# Compatible with version 1.0 (semver)
github "owner/repo" ~> 1.0
# Specific branch
github "owner/repo" "develop"
# Specific commit
github "owner/repo" "abc123"
Adding Frameworks to Xcode
Using XCFrameworks (Recommended):
- Run
carthage update --use-xcframeworks - In Xcode, select your target
- Go to General > Frameworks, Libraries, and Embedded Content
- Click + and select Add Other > Add Files
- Navigate to
Carthage/Build/and select the.xcframework
Using Traditional Frameworks:
- Run
carthage update - Add frameworks from
Carthage/Build/iOS/orCarthage/Build/Mac/ - Add a Run Script build phase for copying frameworks:
/usr/local/bin/carthage copy-frameworks
Input Files:
$(SRCROOT)/Carthage/Build/iOS/SomeFramework.framework
Appium WebDriverAgent
If Appium requires building WebDriverAgent with Carthage:
-
Navigate to WebDriverAgent directory:
cd ~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragentNote: The exact path to
appium-webdriveragentmay vary depending on your installation method (global vs. local, npm vs. other package managers). To locate the correct directory, search forappium-webdriveragentin your global or project-localnode_modules, or runnpm ls -g appium-xcuitest-driverto confirm the install location. -
Bootstrap dependencies:
./Scripts/bootstrap.sh
This script uses Carthage to fetch and build WebDriverAgent dependencies.
Troubleshooting
libimobiledevice
“Could not connect to lockdownd”
The device may not be trusted. Unlock the device and run:
idevicepair pair
Then tap “Trust” on the device.
“No device found”
- Ensure the device is connected via USB
- Check USB cable (some cables are charge-only)
- Try a different USB port
- Restart the device
“Could not start service”
Ensure the device is unlocked and on the home screen.
ideviceinstaller
“Could not connect to lockdownd”
This usually means the device doesn’t trust the computer:
- Disconnect and reconnect the device
- Unlock the device
- Tap “Trust” on the trust dialog
- Try the command again
“No device found”
Ensure the device is connected via USB (not just charging), unlocked, and not in a call or using the camera.
# Kill and restart usbmuxd
sudo killall usbmuxd
sudo launchctl start com.apple.usbmuxd
Installation fails with provisioning error
The app must be signed with a valid provisioning profile that includes the device’s UDID. For development:
- Add the device to your Apple Developer account
- Regenerate provisioning profiles
- Re-sign the IPA file
ios-deploy
“Could not find Developer Disk Image”
Your iOS version may be newer than your Xcode version. Update Xcode to the latest version.
“The device is locked”
Unlock your device and trust the connected computer.
“Could not find matching provisioning profile”
Ensure your app is signed with a valid provisioning profile that includes the device UDID.
Permission denied
If you encounter permission issues, try reinstalling Xcode or the Command Line Tools first, as this usually resolves permissions without modifying the Xcode bundle.
Caution: Recursively changing permissions on Xcode app contents can interfere with future Xcode updates and code signing. Use this as a last resort only.
sudo chmod -R 755 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
ios-webkit-debug-proxy
“Could not connect to device”
Ensure:
- Web Inspector is enabled on the device
- The device is connected via USB and trusted
- Safari or a web view is open on the device
Port already in use
Kill existing proxy instances:
# Find the process
lsof -i :9222
# Kill it
kill -9 <pid>
No web views detected
- Make sure a Safari tab or web view is actually open
- Check that Web Inspector is enabled in Safari settings
- Try restarting the proxy and Safari
Proxy crashes on connection
Update to the latest version:
brew upgrade ios-webkit-debug-proxy
Carthage
“Build Failed”
Clear the cache and retry:
rm -rf ~/Library/Caches/org.carthage.CarthageKit
carthage update --platform iOS
Xcode version mismatch
If using multiple Xcode versions:
sudo xcode-select -s /Applications/Xcode.app
carthage update --platform iOS
Module not found
Ensure the framework is properly linked in Xcode:
- Check Build Settings > Framework Search Paths
- Add
$(PROJECT_DIR)/Carthage/Build/iOSif missing
Resources
Official project website with documentation
Official repository with source code and issues
Source code and documentation for ideviceinstaller
Official repository with documentation and releases
Official guide for configuring the XCUITest driver for real iOS devices
Source code and documentation
Official repository with documentation and releases