How to Erase and Restore MacBooks Using USBHub3c and DFU Automator

2024 December 12

This guide presents an example shortcut to DFU-restore a MacBook using USBHub3c, DFU Automator, and Apple Configurator. 

Apple Devices can be put into Device Firmware Update (DFU) mode to allow for firmware updating and restoration, as well as the deployment of custom OS images. This is achieved by sending Vendor-Specific Messages (VDMs) to a DFU-capable port on the target device. VDMs are point-to-point and are not passed on by a USB Hub; however, USBHub3c can generate and send arbitrary VDMs directly to connected devices. This lets Mac Sysadmins re-image multiple Macs at once, greatly speeding up deployment.

DFU Automator is a small application that enables Apple Shortcuts to control USBHub3c’s DFU functions. DFU Automator operates as a background tool, responding to commands issued by Apple Shortcuts. When combined with Apple Configurator actions, shortcuts can fully automate Mac deployment and provisioning.

Included with DFU Automator is an example shortcut showing how to DFU restore a Macbook on port 1 of USBHub3c

DFU automator features:

  • Send DFU Mode or Reboot VDMs to a macbook

  • Send an arbitrary VDM (Hexstring input)

  • Disable or enable hub ports

  • Get ECID of an attached Apple device

Installation

  • Install Apple Configurator 

If you haven’t already, install Apple configurator from the App store

  • Install DFU Automator

    • Download DFU Automator 

      DFU Automator .dmg folder

    • Open the .dmg disk image and drag DFU Automator into the Applications folder
    • Open DFU Automator from the Applications folder once to allow Shortcuts to recognize it

Add the example shortcut to Apple Shortcuts

  • In the Examples Folder, open the shortcut titled Erase+Restore MacBook on USBHub3c Port #1

Add Shortcut popup

  • Click Add Shortcut 
    • The shortcut will now appear in the Shortcuts app under All Shortcuts

         

  • Click the shortcut’s icon (not the play button that appears on hover) to view the workflow:

Example shortcut

What does each step of the shortcut do?

To understand each step of the shortcut, Control-click an action and select Show Info.

Key Actions

DFU Automator set port number
  • Sets the USBHub3c port number for the MacBook to be updated (set to 1 by default)
DFU Automator -- send VDM: Set DFU Mode
  • Sends a Set DFU Mode message on hub # Hub Serial Number on ports [# Number]
    • Tells DFU Automator to have USBHub3c send a Vendor-Defined-Message to put a MacBook on port [# Number] into DFU mode
    • If only one hub connected, Hub Serial Number can be blank
Wait 5 seconds
  • Waits 5 seconds to give the MacBook time to enter DFU Mode
Get EDID from hub port
  • Tells DFU Automator to read the ECID of the attached MacBook on the specified port
Configurator: find connected devices from ECID
  • Tells Apple Configurator to convert the ECID to a Connected Device Entity for use in other Apple Configurator shortcut actions
Configurator: erase and restore
  • Erases and restores the connected devices. 
     
    • Warning, all data and settings will be removed!
       
  • IPSWs to Install:  Select additional IPSW files to install on connected devices. Configurator will choose the correct IPSW for the device being updated

Example Usage

To use the example to DFU-restore a MacBook:

  1. Locate the DFU-enabled port on the target Mac:
    1. Apple Silicon MacBooks: Left side, towards the hinge
    2. Intel MacBooks with T2 chip: Left side, away from the hinge
    3. Desktops: Refer to Apple Support for more details.
  2. Connect the host Mac to USBHub3c port 0
  3. Connect the target MacBook’s DFU-enabled USB-C port to USBHub3C port 1
    1. Warning: target MacBook will be erased!
  4. In Shortcuts, click the play button in the upper right of the shortcut icon or the expanded view of the shortcut

    DFU Automator Privacy popup

  5. Click "Allow" to let the shortcut run actions
    • The target MacBook will chime and boot into DFU mode with a black screen

      Configurator privacy popup

  6. Approve any other privacy popups that appear:
    • Allow configurator to find devices
    • Allow the shortcut share the device ECID with Apple Configurator
       
  7. Apple Configurator will erase and restore the MacBook on port 1

Restoring Multiple Devices Simultaneously

Shortcuts and Configurator actions can be run in parallel, allowing multiple MacBooks to be restored asynchronously. The restore shortcut can be copied and the port number can be set for each port. To use, connect a MacBook to an available USBHub3c port and manually trigger the corresponding restore shortcut matching the port number.

More information about using Apple Configurator with Shortcuts can be found here.

 

 

 

Add New Comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
We are bots. Are you?