Fix “The developer disk image could not be mounted” in Xcode

Xcode cannot set your iPhone up for development: error 12040. What the disk image is, the three usual causes, and the fixes Apple's engineers give.

By Sigsten Gustavii· · 8 min read

Build your own plant watering log with Borel

Build this app

You choose your iPhone, press Run, and Xcode stops with "The developer disk image could not be mounted on this device." Below it there are lines most people skip: Domain com.apple.dt.CoreDeviceError, Code 12040, and a Failure Reason that names an error. Sometimes the same words appear inside another one, as "Previous preparation error".

This guide explains what the disk image is, how to read the line that tells you why it failed, the three causes behind nearly every report on Apple's Developer Forums, and the fixes in the order worth trying them.

What the developer disk image is

Before Xcode can run and debug an app on a phone, it sets the phone up for development. Part of that is mounting a developer disk image, which Apple's tools shorten to DDI. Xcode's own failure messages describe its purpose: they speak of a DDI that can be used to enable DDI services on the device. Without it, Xcode can build your app but not run it there.

Since iOS 17 this works differently from before. An Apple Developer Tools engineer explained on the forums that Xcode now uses a device stack called CoreDevice, with one DDI per platform instead of one per iOS version, shared by every Xcode on the Mac and updated whenever you install a newer Xcode. That explains the most common cause below.

The parts of the message, and what each one tells you
The wordsWhat they mean
The developer disk image could not be mountedXcode could not set up the phone's developer services
Domain: com.apple.dt.CoreDeviceError, Code: 12040It is the mounting step that failed, not your app
Failure Reason: …The real cause, in Apple's words; read this line
Previous preparation errorIt failed before, and Xcode is repeating the earlier result

Read the failure reason

The headline is the same every time. The line under it differs, and it points at the fix:

  • Failed to find a DDI that can be used, often with "did not have compatible CoreDevice content" or "too old": the disk image on your Mac does not fit the iPhone. Update Xcode and its components.
  • The bundle image is missing the requested variant for this device: your Xcode does not know this iPhone model. In September 2024 an Apple engineer told people with an iPhone 16 on Xcode 15 that this is expected, and to update to Xcode 16.
  • Failed to query device property, a reconnect or a networking error: Xcode could not talk to the phone properly. Look at the connection, a VPN or security software.
  • An error ending in TATSUDeclinedAuthorization: reported on macOS Ventura with iOS 17, with no fix posted. In the same thread another person's cure for the message was updating the Mac, so check macOS too. Apple has not documented this one.

Fix 1: update Xcode, then its components

Look up your iPhone's iOS and your Xcode in Apple's SDK and system requirements table. Its Device Support column is the range each Xcode can install and debug on: on 20 November 2026, Xcode 27.2 listed iOS 17 or later and needed macOS Tahoe 26.6 or later. A brand-new iPhone model also needs an Xcode that knows it, whatever the column says.

Then refresh the device support itself. Apple's page on Xcode components gives the commands for installing hardware support in between Xcode releases:

Apple's commands to install Xcode's newest device components
xcode-select -s /Applications/Xcode.app
xcodebuild -runFirstLaunch -checkForNewerComponents

Quit Xcode, open it again, reconnect the iPhone and run. If your Xcode shows "could not locate device support files" instead, the version gap is the whole story: see device support files.

Fix 2: get a VPN or security app out of the way

Even over a cable, Xcode talks to the iPhone through a network connection. Apple's technote TN3158 says so and lists what can block it: VPN apps using packet filter rules, VPN apps that send all traffic through their tunnel, and security configurations using packet filtering. Apple's support article on connecting an iPhone also tells you to check for VPN and other third-party security software.

The forum reports agree. People cleared this exact message by quitting a VPN, by quitting a proxy tool used for watching network traffic, and in January 2026 by pausing security software that was filtering Xcode's local network traffic. Turn such software off, reconnect the phone and run again. If it is a work Mac with software you cannot turn off, Apple's technote says to ask your IT department.

Fix 3: give Xcode a clean connection

  1. Unlock the iPhone and keep it unlocked while Xcode prepares it.
  2. Plug it straight into the Mac, not through a hub or dock. An Apple engineer on the forums recommends connecting the device directly with an Apple-brand cable to rule the cable out.
  3. If the iPhone asks whether to trust this computer, tap Trust.
  4. Restart the iPhone, and quit and reopen Xcode.

Fix 4: switch Developer Mode off and on

Several people on the forums cleared the message by turning Developer Mode off and on again with a restart in between. Apple documents the switch itself: Settings, Privacy & Security, Developer Mode. Turning it off restarts the phone, and turning it on asks for another restart and your passcode. Then connect the phone and let Xcode prepare it again. Apple has not said why this helps, so treat it as a thing to try, not a diagnosis.

Fix 5: ask Xcode what it sees

If none of that works, Apple's engineer gave a way to check, in Terminal:

Apple's engineer's commands to check the disk image
xcrun devicectl list devices
xcrun devicectl list preferredDDI

If the phone shows as connected, the disk image mounted. If it shows as "connected (no DDI)", mounting is the problem, and the second command says why no usable disk image was found. A third command the engineer gave, xcrun devicectl device info ddiServices with your device's identifier, reports the detailed error. That text is what to search for, or to attach to a report to Apple.

Is it this message, or a neighbour?

Messages about setting up the iPhone in Xcode, checked 20 November 2026
What Xcode saysWhat it usually meansWhere the fix is
The developer disk image could not be mountedThe phone's developer services did not startThis page
Could not locate device support filesXcode is older than the iPhone's iOSUpdate Xcode
iPhone is busy: PreparingXcode is still setting the phone upWhy it waits
Developer Mode disabledThe switch on the iPhone is offTurn on Developer Mode

Do you need the disk image at all?

For Xcode, yes: it is how Xcode runs your app with the debugger attached, steps through your code and copies the phone's symbols. That is what a developer wants. If you only want the app on your phone, to use it, none of that is needed. An app installs on an iPhone without a debugger, the way every app from the App Store does.

That is the route Borel takes. Borel builds the app from your description, in Swift with SwiftUI, with Xcode on its own Mac, and you try it in an iPhone simulator in your browser, where nothing has to be mounted on a phone.

When you want it on your own iPhone, Borel Companion, a free download for a Windows 10 or 11 PC or a Mac, signs it with your Apple ID and installs it. Installing with Companion comes with a paid plan, Pro, from $25 a month.

  • No disk image, no debugger. Companion copies the signed app to the iPhone and asks the phone to install it. It mounts nothing and starts no debugging session, so the step this page is about is not part of it.
  • No Apple software on Windows. On a PC, Companion talks to the iPhone itself; Windows Update adds the iPhone's driver.
  • Done means on the phone. Companion calls an install finished only when the iPhone's own list of apps shows the new version.
  • A cable once. The initial install is over the cable, with Trust and Developer Mode; later versions go over Wi-Fi.

Developer Mode is still needed, because the iPhone asks for it for apps installed for development. A free Apple ID works and keeps 3 of your apps at a time, and Companion signs each one again every 7 days while it runs. When the app is for other people too, Borel can publish the same app to the App Store with Pro and Apple's Developer Program, and an App Store app needs no Developer Mode. See how it works.

The bottom line

"The developer disk image could not be mounted" means Xcode could not start its developer services on your iPhone. Read the Failure Reason line. Most often the cure is a newer Xcode followed by Apple's component check, or a VPN or security app that has to step aside. Then try a direct cable, an unlocked phone, a restart and Developer Mode off and on. Apple's devicectl commands tell you what Xcode sees when nothing else does.

For the full route from Xcode to an icon on your Home Screen, see how to run your Xcode app on your own iPhone.

Questions people ask

What does error 12040 mean in Xcode?

It is the CoreDevice error code shown with "The developer disk image could not be mounted on this device". The Failure Reason line under it says what went wrong.

What is the developer disk image?

The part Xcode puts on the iPhone to turn on its developer services, such as running your app with the debugger. Since iOS 17 there is one per platform, updated when you install a newer Xcode.

Do I need a newer Xcode to fix it?

Often. Check Apple's SDK and system requirements table for your iPhone's iOS, and remember that a new iPhone model needs an Xcode that knows it. Then run xcodebuild -runFirstLaunch -checkForNewerComponents.

Can a VPN cause this error?

Yes. Apple's technote TN3158 says VPN apps and security configurations that filter packets can block the connection Xcode uses to the device, even over a cable.

Will deleting the DeveloperDiskImages folder fix it?

Some people report it helped, but Apple does not document it. Update Xcode and run Apple's component check before deleting anything.

Can I install my app without mounting the disk image?

Not from Xcode's Run button. A tool that installs without debugging, such as Borel Companion, does not mount it; the iPhone still needs Developer Mode on.

I think the useful habit here is reading the line under the headline, because that is where Xcode says what really failed.

– Sigsten

Build your own plant watering log

Your idea is already written. Press the button, read it, change anything, and Borel builds it, free to start.

An app just for me that reminds me when to water each of my plants, with a photo of each one, the last time I watered it and a note on how it is doing.
Build this app

Keep reading