CLU tool for iOS as like ADB for Android

CLU is nothing but the Command Line Utility tool. To save the space for the menu link name, I’ve used the short term CLU. You know very well ADB is nothing but the Android Debug Bridge used to connect and control the Android emulators or devices in the command prompt. I would like to share some of the important xcrun commands in this post, which will be useful for you to control the iOS simulator.

XCRUN is going to play a major role for iOS platform as like ADB in Android platform. XCRUN is a dedicated one for iOS and ADB is a dedicated one for Android, which cannot be used vice-versa.

What is XCRUN?

XCRUN is a binary file available in the XCODE tool in which simulators installed in the
device can be controlled. If you compare with the Android platform, it is almost equivalent to ADB(Android Debug Bridge). ADB can be used to control the Android Emulators and the real devices running in the Android platform. XCODE is an IDE with the iOS SDK’s which is used to develop the iOS applications in Mac machine. And the same XCODE should be used for iOS Automation to build the code, install the application, invoke the application etc,.

What is SIMCTL?

simctl will work with the xcrun binaries in which it is nothing but Command line utility to control the Simulator, which is again developed by using the Ruby. All the simulator controlled commands will work based on the combination of XCRUN and SIMCTL.

SIMCTL – Simulator Control

Run the following the commands in the terminal window and check the expected results for your reference;

How to list the device types, runtimes and devices;

$ xcrun simctl list

How to list the devices;

$ xcrun simctl list devices

How to list the available device types;
$ xcrun simctl list device types

How to list the runtimes available in the Mac;

$ xcrun simctl list runtimes

How to list the Known Devices;

$ instruments -s devices

How to get the real device UDID; Tried with iPhone 7 real device

$ idevice_id -l

How to install the .APP file in the simulator under the command line;

$ xcrun simctl install<space><device id><space><path of the .app build file>
$ xcrun simctl install 37CEC824-C20E-4D77-8A69-59DD778928AF /Users/gopikannan/Library/Developer/Xcode/DerivedData/UICatalog-alaibrcewphnhpbkacmggbnkdyim/Build/Products/Debug-iphonesimulator/

How to Uninstall the .APP file in the simulator under the command prompt;

$ xcrun simctl uninstall<space><device id><space><application identifier>
$ xcrun simctl uninstall 37CEC824-C20E-4D77-8A69-59DD778928AF

How to take screenshot;

$xcrun simctl io<space><device id><space>screenshot<space><filename.png>

$ xcrun simctl io 37CEC824-C20E-4D77-8A69-59DD778928AF screenshot testscreen.png

How to record the screen; Ctrl+C to stop in the command prompt;

$xcrun simctl io<space><device id><space>recordVideo<space><>
$ xcrun simctl io 37CEC824-C20E-4D77-8A69-59DD778928AF recordVideo

How to create a simulator in command prompt;
$ xcrun simctl create “iPhone 6” “iPhone 6” 9.2

How to launch the simulator in command prompt;

$crun simctl launch<space><device id><space><application identifier>
$ xcrun simctl launch 37CEC824-C20E-4D77-8A69-59DD766628AF

How to get help information about xcrun simctl? You could get all the command information;
$ xcrun simctl help


2 thoughts on “CLU tool for iOS as like ADB for Android

  1. Great post! Is there a way to print the pasteboard of a connected device (not a simulator?) So far I’m trying `xcrun instruments -w pbaste` and variations on this with no luck. The error I’m receiving is `Instruments Usage Error: Specified target process is invalid: pbpaste`


  2. Actual raw commandline support appears to only support simulators based on what you have shared here Gopi , is that correct?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s