Remote iOS debugging

There are multiple reasons for the need of remote debugging. In this case I needed to connect an iPhone to a Windows PC :/ and debug it simultaneously.

Project Setup

Attaching the Debugger to the iOS Device

This Tutorial is split up into multiple smaler steps starting with step 1:

~ 1.

At first you need to mount the DeveloperDiskImage.dmg for the current iOS version, in this case 8.4. To do so type in the Terminal:

hdiutil attach /Applications/\ \(12H141\)/DeveloperDiskImage.dmg

Your screen should then look like this:

~ 2.

Copy the debugserver to your preferred directory

cd ~/Documents
mkdir remotedebug
cd remotedebug 
cp /Volumes/DeveloperDiskImage/usr/bin/debugserver .

(After copying the debugserver to your local storage you can unmount the DeveloperDiskImage via hdiutil detach /Volumes/DeveloperDiskImage/)

~ 3.

You need to code sign the debugserver and for this you need an entitlements file. The file can be created by doing the following:

nano entitlements.plist

Then copy the following lines into the terminal window:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0"> 

Press ctrl + o (ctrl and o), then return and strg + x to exit.
To make sure everything worked well, type cat entitlements.plist and your terminal screen should look like this:

~ 4.

You now need to resign the debugserver binary with the newly created entitlements file:

codesign -s - --entitlements entitlements.plist -f debugserver

~ 5.

Make sure that ssh is installed on your jailbreaked device. (If not: Open Cydia on the device and look for the user guide "OpenSSH Access How-To")

Then copy the newly singed debugserver to your device. You can find the IP Address of the device in the info tab of the currently connected wifi.

scp debugserver root@[insert IP Address]:/var/root

If asked, type yes into the console as seen in the screenshot. (The standard root password is "alpine")

~ 6.

You now need to start the debug server. For this connect to your device using ssh:

ssh root@[insert IP Address]

Then start the Application you want to debug and attach the debugger.

./debugserver *:1234 -a "Twitter"

Now the debugserver is running and is waiting for connections.

Start lldb on your computer with the following commands:


When lldb is started, connect it to the debugserver:

platform select remote-ios

process connect connect://[insert IP Address]:1234

You are now successfully connected to the remote debug session! Pressing c resumes the process. For lldb commands check :

And for further reading: