I recently reset a base-model M4 Mac mini and ended up with a machine that would no longer boot normally.

Instead, the status light repeatedly flashed amber and the Mac would not reach macOS Recovery.

Apple’s normal firmware recovery procedure relies on connecting the affected Mac to another Mac. I did not have access to another modern Mac, but I did have an Ubuntu laptop.

After some experimentation, I was able to completely recover the M4 Mac mini from Linux using the open-source libimobiledevice tools.

This guide documents the exact process that worked for me.

Important: Firmware restoration is inherently risky. idevicerestore itself warns that it can irreversibly destroy user data. Back up anything important before attempting this where possible. This guide documents my successful experience with a base M4 Mac mini (Mac16,10) and should not be treated as an official Apple-supported recovery procedure.

My Hardware and Software

Affected Mac:

Recovery computer:

The Mac and laptop were connected directly over USB.

1. Confirm That Linux Can See the Mac

With the Mac connected, I ran:

lsusb

Initially the Mac was in normal iBoot Recovery mode and appeared as:

05ac:1281 Apple, Inc. Apple Mobile Device [Recovery Mode]

This was encouraging because it confirmed that the Mac was still communicating at the firmware level.

2. Install the Recovery Tools

On Ubuntu:

sudo apt update
sudo apt install -y irecovery idevicerestore usbmuxd

I then checked the installed version:

idevicerestore --version

My system reported:

idevicerestore 1.0.1
(libirecovery 1.3.1, libtatsu 1.0.5)

3. Identify the Mac

I queried the Mac using:

sudo irecovery -q

The important part of the output was:

MODE: Recovery
PRODUCT: Mac16,10
MODEL: j773gap
NAME: Mac mini (M4, 2024)

At this point Linux correctly knew that the connected device was an M4 Mac mini.

4. The First Restore Attempt Failed

I initially tried:

sudo idevicerestore --latest

The utility contacted Apple and showed the firmware versions currently being signed for Mac16,10.

I selected the latest available firmware.

The process successfully:

But then it failed with:

Device did not disconnect. Possibly invalid iBEC.
Reset device and try again.

This turns out to be an important detail.

There are existing reports of M4 Mac minis hitting this same problem when idevicerestore begins from ordinary Recovery mode.

The Mac was not damaged by the failed attempt. Running:

lsusb
sudo irecovery -q

showed that it had simply returned to:

MODE: Recovery
PRODUCT: Mac16,10
MODEL: j773gap

5. Put the M4 Mac mini Into Port DFU Mode

This was the breakthrough.

Instead of starting the restore from Recovery mode, I put the Mac mini into Port DFU mode.

With the USB connection between the Linux laptop and Mac mini in place:

  1. Shut down the Mac mini.
  2. Disconnect its power cable.
  3. Press and hold the Mac mini power button.
  4. While continuing to hold the button, reconnect power.
  5. Continue holding the button for roughly 10 seconds.
  6. Release it.

The display remained black.

Running:

lsusb

now showed:

05ac:f014 Apple, Inc. Apple Device (Port DFU Mode)

That was the state we wanted.

6. Start the Restore From Port DFU

I ran:

sudo idevicerestore --latest

The utility identified the Mac correctly:

Found device in Port DFU mode
Identified device as j773gap, Mac16,10

I selected the latest signed macOS firmware.

The crucial difference appeared almost immediately:

Port DFU restore successful. Continuing.

From there, idevicerestore continued through the complete Apple Silicon boot and restoration chain.

Among other things it:

Eventually:

Waiting for device to enter restore mode...
About to restore device...
Connecting now...
Connected to com.apple.mobile.restored, version 15
Device ... has successfully entered restore mode

This was the point where I knew the Port DFU approach had solved the original iBEC transition problem.

7. Let the Restore Finish

From there the utility continued installing and updating firmware.

There were several messages such as:

Unknown operation (80)
Unknown operation (85)

These looked alarming at first, but they were not fatal.

The restore continued requesting Apple TSS tickets, sending firmware components, flashing firmware, and progressing normally.

The firmware stage eventually reached:

Flashing firmware
[==================================================] 100.0%

Finally:

Got status message
Status: Restore Finished
DONE
[==================================================] 100.0%

The restore was complete.

8. The Mac Booted Normally

After the restore, the M4 Mac mini rebooted into the normal macOS first-run setup assistant.

It initially displayed the keyboard and mouse pairing screens at:

support.apple.com/macsetup

After connecting input devices, macOS setup completed normally.

The Mac is now fully operational.

The Important Lesson

The biggest discovery from this recovery was:

For this M4 Mac mini, starting idevicerestore from ordinary Recovery mode failed, but starting from Port DFU mode succeeded.

The unsuccessful path was:

Recovery
  ↓
iBEC upload
  ↓
Device did not disconnect
  ↓
FAIL

The successful path was:

Port DFU
  ↓
DFU
  ↓
iBSS / iBEC
  ↓
Restore ramdisk
  ↓
macOS Restore mode
  ↓
Firmware flashing
  ↓
Restore Finished

If you encounter the Possibly invalid iBEC error on an M4 Mac mini while using Linux, entering Port DFU before starting the restore may be the critical difference.

Useful Commands

Identify USB mode:

lsusb

Identify the Mac:

sudo irecovery -q

Check restore utility version:

idevicerestore --version

Restore using one of Apple’s currently signed firmware versions:

sudo idevicerestore --latest

A full erase can also be requested using:

sudo idevicerestore --erase --latest

But do not use the erase option unless you actually intend to wipe the machine.

Final Notes

This was performed successfully on:

Mac mini (M4, 2024)
Mac16,10
j773gap

using:

Ubuntu 26.04 LTS
idevicerestore 1.0.1
libirecovery 1.3.1
libtatsu 1.0.5

Your results may differ with another Mac model, Linux distribution, firmware version, USB controller, cable, or version of idevicerestore.

Apple’s official recovery procedure should still be considered the supported approach when another suitable Mac is available.

But if another Mac is simply unavailable, this experience demonstrates that recovering an M4 Mac mini from Linux can be possible.