# Initial Setup

libimobiledevice requires a few files and some commands you can note down. Let's download those.

## Prerequisites

* Windows, Mac or Linux computer with an Internet connection
* iOS device with an Internet connection
* Lightning cable (for connecting the device to your computer)

## Downloading libimobiledevice

On your computer, download libimobiledevice for your OS.\
[Download for Windows](https://github.com/libimobiledevice-win32/imobiledevice-net/releases/)\
[Download for macOS and Linux](https://libimobiledevice.org/#get-started)

{% tabs %}
{% tab title="Windows" %}

1. Extract the ZIP archive, and place it in a place you won't delete
2. Press CTRL+R, type `sysdm.cpl`, and press Enter
3. Click "Advanced", and "Environment Variables"'
4. Click "Path", and "Edit..."
5. Click "Browse..." and select the folder you extracted
6. Press OK, and close the windows
   {% endtab %}

{% tab title="macOS / Linux" %}
After installing with Homebrew or APT, you should be good to go!
{% endtab %}
{% endtabs %}

## Downloading the Developer Disk Image

When tethering, you need to mount a Developer Disk Image. We'll download this on your computer.

1. Head over to [this GitHub repository](https://github.com/haikieu/xcode-developer-disk-image-all-platforms/tree/master/DiskImages/iPhoneOS.platform/DeviceSupport). It contains all the developer disk images, taken straight from Apple.
2. Download the correct archive for your device.

{% hint style="warning" %}
Not all iOS versions have a disk image. If your version is not listed, choose the version before it.
{% endhint %}

Extract the archive, and save it somewhere you can find it later.

## Noting down some commands

There are some commands here that you can copy+paste later. Let's find them.

Connect your iOS device to your computer, and open a terminal/command prompt before proceeding.

#### Finding your devices UUID

1. Type `idevice_id` and press Enter

Now you will see your devices in this list. Note down the number before `(USB)` or `(Network)`.

{% hint style="info" %}
If your device says `(Network)` besides it, you don't need your device connected via USB for this to work! Just remember to add the `-n` parameter to the commands you are running.
{% endhint %}

#### Finding UTMs Bundle Identifier

1. Type `ideviceinstaller -l -u` , and paste your devices UUID.
2. Press Enter

This will show every app on your device, and will probably be a very long string of text. You can paste this into a text editor like TextEdit or Notepad, and search for "UTM".

In the line you found "UTM", the bundle identifier is the left-most entry. e.g `com.utmapp.UTM`. Note this string down.

#### Noting down the launch commands

Now we'll note down the commands you need to run every time you are tethering UTM on your device.

1. Mounting the disk image\
   `ideviceimagemounter -u [your devices UUID] [path to DeveloperDiskImage.dmg]`\
   \
   Example: `ideviceimagemounter -u 12345678-ABCEDEFGHIJKLMNO C:\Users\BluDood\15.0\DeveloperDiskImage.dmg`
2. Tethering UTM\
   `idevicedebug -u [your devices UUID] --detach run [UTM bundle ID]`\
   \
   Example: `idevicedebug -u 12345678-ABCEDEFGHIJKLMNO --detach run com.bludood.UTM`

## Done!

That's the initial setup process for libimobiledevice. In the next step, we'll run the commands and look at some troubleshooting steps:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.bludood.com/utm/tethering-utm/libimobiledevice/initial-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
