From 1183e4601efaebb83162b583d7aa9518d27e306d Mon Sep 17 00:00:00 2001 From: Francis Date: Wed, 31 Jan 2024 16:35:02 +0100 Subject: [PATCH 01/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 2038fa7..e4b1b45 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -59,7 +59,7 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Exiting DBMa mode... OK ~ % ``` -1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. +1. (Optional, instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/)) Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) From 32829c8606607c99fe4c36068ccfcc4420d4e80b Mon Sep 17 00:00:00 2001 From: Francis Date: Wed, 31 Jan 2024 17:17:03 +0100 Subject: [PATCH 02/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 48 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index e4b1b45..7dfc047 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -6,9 +6,9 @@ draft: false # What is [macvdmtool](https://github.com/AsahiLinux/macvdmtool)? -It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinux project](https://asahilinux.org/). macvdmtool lets you put an Apple Silicon Mac in DFU mode with terminal commands instead of requiring awkward keyboard gymnastics. +It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinux project](https://asahilinux.org/). macvdmtool lets you put any Apple Silicon or Intel Macs with the T2 chip (2018 and forward) in DFU mode with terminal commands instead of requiring awkward keyboard gymnastics. -> **Note**: macvdmtool requires that you have _two_ Apple silicon machines on hand. One acts as the "host" machine which initiates the "target" machine to perform a restore. +> **Note**: macvdmtool requires that the host machine is Apple Silicon based, Intel macs do not seem to support this tool as a host. # Setting up and using macvdmtool @@ -20,18 +20,19 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu git clone https://github.com/AsahiLinux/macvdmtool.git ``` 1. Change into the macvdmtool directory and compile the tool - ```text - ~ % cd macvdmtool && make + ```shell + macvdmtool && make cc -o macvdmtool main.o -framework CoreFoundation -framework IOKit -lc++ - macvdmtool % ``` -1. (Optional) Copy macvdmtool to somewhere that is in the default path. - ```text - macvdmtool % sudo cp macvdmtool /usr/local/bin - Password: - macvdmtool % +1. Copy macvdmtool to path. + ```shell + sudo cp macvdmtool /usr/local/bin + ``` + Run below command to see if its installed and added to path + ```shell + macvdmtool ``` -1. Launch Apple Configuration 2 and install the "Automation Tools". +1. Launch Apple Configurator 2 and install the "Automation Tools". ![Install Automation Tools](/images/macvdmtool/cfgutil/install_automation.png) @@ -39,15 +40,18 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu ![Install Automation Tools password prompt](/images/macvdmtool/cfgutil/install_password.png) -1. Connect the host and target Macs together via an official Apple USB-C charging cable. The cable must be plugged into the DFU port on both ends. +1. Connect the host and target Macs together via an official Apple USB-C charging cable or a TB3/TB4 cable. The cable must be plugged into the DFU port on both ends and support data transfer. - - On the M1 Macbook Air, the DFU port is the usb-c port closest to the screen. - - On the M1 Pro, the DFU port is the usb-c port closest to the Magsafe connector. + - On Apple Silicon machines, the DFU port is closest to the screen + - On Intel machines, the DFU port is closest to the trackpad -1. Put the target mac in DFU mode. +1. Put the target Mac in DFU mode. - ```text - ~ % sudo macvdmtool dfu + ```shell + sudo macvdmtool dfu + ``` + Above command should return below: + ```text Mac type: J313AP Looking for HPM devices... Found: IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/i2c0@35010000/AppleS5L8940XI2CController/hpmBusManager@6B/AppleHPMBusController/hpm0/AppleHPMARM @@ -57,9 +61,8 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Entering DBMa mode... Status: DBMa Rebooting target into DFU mode... OK Exiting DBMa mode... OK - ~ % ``` -1. (Optional, instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/)) Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. +1. Optional (instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive): Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) @@ -67,8 +70,11 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu 1. Grab the IPSW you want to restore from [Mr. Macintosh's database](https://mrmacintosh.com/apple-silicon-m1-full-macos-restore-ipsw-firmware-files-database/). 1. Use `cfgutil` to restore that IPSW. + ```shell + cfgutil restore -I ~/Downloads/UniversalMac_12.1_21C5021h_Restore.ipsw + ``` + Should result in: ```text - ~ % cfgutil restore -I ~/Downloads/UniversalMac_12.1_21C5021h_Restore.ipsw objc[53015]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1da64c9e8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d782c8). One of the two will be used. Which one is undefined. objc[53015]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1da64ca38) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d78318). One of the two will be used. Which one is undefined. cfgutil: restore: target OS is 12.1 @@ -77,7 +83,7 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Step 2 of 2: Installing System [2/2] [**********************************>] 99% ``` -At this point you'll see an Apple logo and a loading bar on the target mac. +At this point you should see an Apple logo and a loading bar on the target Mac. After a few minutes, the Mac will reboot and launch the standard Setup Assistant experience. From 7878c9715f06a63f8b1bf5370f5cb862b65546d6 Mon Sep 17 00:00:00 2001 From: Francis Date: Wed, 31 Jan 2024 18:06:51 +0100 Subject: [PATCH 03/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 7dfc047..14da3be 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -3,16 +3,17 @@ title: "DFU restore Apple Silicon Macs with macvdmtool" date: 2021-11-04 draft: false --- +(updated 2024-01-31, new info about Intel macs) # What is [macvdmtool](https://github.com/AsahiLinux/macvdmtool)? It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinux project](https://asahilinux.org/). macvdmtool lets you put any Apple Silicon or Intel Macs with the T2 chip (2018 and forward) in DFU mode with terminal commands instead of requiring awkward keyboard gymnastics. -> **Note**: macvdmtool requires that the host machine is Apple Silicon based, Intel macs do not seem to support this tool as a host. +> **Note**: macvdmtool requires that the **host machine** is **Apple Silicon** based, Intel macs do not seem to support this tool as a host. # Setting up and using macvdmtool -1. Install Xcode and the Xcode commandline tools. +1. Install [Xcode](https://developer.apple.com/xcode/) and the [Xcode commandline tools](https://mac.install.guide/commandlinetools/). 1. Install [Apple Configurator 2](https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12) from the Mac App Store. 1. Clone [macvdmtool](https://github.com/AsahiLinux/macvdmtool.git) @@ -42,8 +43,8 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu 1. Connect the host and target Macs together via an official Apple USB-C charging cable or a TB3/TB4 cable. The cable must be plugged into the DFU port on both ends and support data transfer. - - On Apple Silicon machines, the DFU port is closest to the screen - - On Intel machines, the DFU port is closest to the trackpad + - On Apple Silicon machines, the DFU port is closest to the screen on the left side + - On Intel machines, the DFU port is closest to the trackpad on the left side 1. Put the target Mac in DFU mode. @@ -62,7 +63,22 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Rebooting target into DFU mode... OK Exiting DBMa mode... OK ``` -1. Optional (instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive): Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. + +1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. + (If it does not appear, try unplugging and plugging back in the cable between the host and target) + + ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) + +### For easier use of the DFU command you can add it as an alias +1. Find the configuration file for your terminal, usually [.zshrc or .bash_profile](https://presscargo.io/articles/how-to-add-an-alias-in-macos-with-terminal/) located in your users folder) +2. Edit it with a file editor of your choice and add `alias dfu="sudo macvdmtool dfu"` to a new line at the bottom of the file, save and quit +3. Run `source ~/.zshrc` or `source ~/.bash_profile` to activate the edited file +4. Now you can run `dfu` in terminal instead of `sudo macvdmtool dfu` +5. Apply this to the other commands available through `macvdmtool` if you'd like, being aware of `reboot` already being a native macOS command. + +## Optional when restoring/reviving +Instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can do it manually (only works if the target is an Apple Silicon model) +1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) @@ -73,7 +89,7 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu ```shell cfgutil restore -I ~/Downloads/UniversalMac_12.1_21C5021h_Restore.ipsw ``` - Should result in: + Should result in something like this: ```text objc[53015]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1da64c9e8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d782c8). One of the two will be used. Which one is undefined. objc[53015]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1da64ca38) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d78318). One of the two will be used. Which one is undefined. @@ -87,7 +103,7 @@ At this point you should see an Apple logo and a loading bar on the target Mac. After a few minutes, the Mac will reboot and launch the standard Setup Assistant experience. -That's it! Enjoy. +That's it! Enjoy. # Future [automation](https://xkcd.com/1319/) enhancements @@ -105,3 +121,5 @@ See Mr. Macintosh's excellent [blog post on DFU restores](https://mrmacintosh.co + + From f1a5d0a4a9fde88377f0414e9f140e10d281ca9d Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 02:42:06 +0100 Subject: [PATCH 04/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 14da3be..4246ff9 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -69,15 +69,8 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) -### For easier use of the DFU command you can add it as an alias -1. Find the configuration file for your terminal, usually [.zshrc or .bash_profile](https://presscargo.io/articles/how-to-add-an-alias-in-macos-with-terminal/) located in your users folder) -2. Edit it with a file editor of your choice and add `alias dfu="sudo macvdmtool dfu"` to a new line at the bottom of the file, save and quit -3. Run `source ~/.zshrc` or `source ~/.bash_profile` to activate the edited file -4. Now you can run `dfu` in terminal instead of `sudo macvdmtool dfu` -5. Apply this to the other commands available through `macvdmtool` if you'd like, being aware of `reboot` already being a native macOS command. - -## Optional when restoring/reviving -Instead of using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can do it manually (only works if the target is an Apple Silicon model) +## Restoring/reviving +As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with macvdmtool (only works if the target is an Apple Silicon model) 1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) From 882818ad13a617d1a3d7be731caa57fb777a9b1a Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 02:42:39 +0100 Subject: [PATCH 05/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 4246ff9..8352a22 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -3,7 +3,6 @@ title: "DFU restore Apple Silicon Macs with macvdmtool" date: 2021-11-04 draft: false --- -(updated 2024-01-31, new info about Intel macs) # What is [macvdmtool](https://github.com/AsahiLinux/macvdmtool)? From b98e7732572071d8e9178262841667f180c7b60e Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 02:45:46 +0100 Subject: [PATCH 06/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 8352a22..c3f1bfd 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -63,11 +63,6 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Exiting DBMa mode... OK ``` -1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. - (If it does not appear, try unplugging and plugging back in the cable between the host and target) - - ![Apple Configurator 2 is now showing target device in DFU](/images/macvdmtool/apple_configurator/dfu.png) - ## Restoring/reviving As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with macvdmtool (only works if the target is an Apple Silicon model) 1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. From 905d733da9a0c4d8a88e3fd95a2fd3bb884ba78e Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 02:47:00 +0100 Subject: [PATCH 07/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index c3f1bfd..28e1bf0 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -64,7 +64,7 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu ``` ## Restoring/reviving -As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with macvdmtool (only works if the target is an Apple Silicon model) +As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with cfgutil (only works if the target is an Apple Silicon model) 1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) From 1ba4365d5a02c5a293b54717194acf020d7d0417 Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 21:49:02 +0100 Subject: [PATCH 08/11] Update content/posts/macvdmtool.md Co-authored-by: BK --- content/posts/macvdmtool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 28e1bf0..7142b9c 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -63,7 +63,7 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu Exiting DBMa mode... OK ``` -## Restoring/reviving +## Restoring/reviving with cfgutil As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with cfgutil (only works if the target is an Apple Silicon model) 1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) From 03703e274993e7be8f6ed04edbec44ba16a8329f Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 21:51:22 +0100 Subject: [PATCH 09/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 7142b9c..45b5272 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -12,7 +12,14 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu # Setting up and using macvdmtool -1. Install [Xcode](https://developer.apple.com/xcode/) and the [Xcode commandline tools](https://mac.install.guide/commandlinetools/). +1. Install [Xcode](https://developer.apple.com/xcode/) and then run this in terminal to install Xcode command-line tools: + ```shell + xcode-select –-install + ``` + Check that it installed properly: + ```shell + xcode-select -p + ``` 1. Install [Apple Configurator 2](https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12) from the Mac App Store. 1. Clone [macvdmtool](https://github.com/AsahiLinux/macvdmtool.git) From d5aee043e0f37492483f805956efc1333c122c44 Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 21:52:17 +0100 Subject: [PATCH 10/11] Update content/posts/macvdmtool.md Co-authored-by: BK --- content/posts/macvdmtool.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 45b5272..93dba22 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -71,7 +71,9 @@ It is a tool written by [marcan](https://github.com/marcan) under the [AsahiLinu ``` ## Restoring/reviving with cfgutil -As well as using Apple Configurator 2 or in [latest Sonoma update, Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac, you can also do it manually with cfgutil (only works if the target is an Apple Silicon model) +> Alternatively you can use Apple Configurator 2 or [Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) to restore/revive your Mac. + +> **Note**: This method with `cfgutil` only works if the target Mac is Apple Silicon. 1. Confirm the device is in DFU mode by launching Apple Configurator 2. It should look like this. (If it does not appear, try unplugging and plugging back in the cable between the host and target) From 0b14afe09db1314bb05038ed2545f4248bd6c8a8 Mon Sep 17 00:00:00 2001 From: Francis Date: Thu, 1 Feb 2024 21:53:06 +0100 Subject: [PATCH 11/11] Update macvdmtool.md --- content/posts/macvdmtool.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/content/posts/macvdmtool.md b/content/posts/macvdmtool.md index 93dba22..f5236d4 100644 --- a/content/posts/macvdmtool.md +++ b/content/posts/macvdmtool.md @@ -113,9 +113,3 @@ File an issue or PR (pull request) against my blog at https://github.com/discent # Further Readings on DFU See Mr. Macintosh's excellent [blog post on DFU restores](https://mrmacintosh.com/restore-macos-firmware-on-an-apple-silicon-mac-boot-to-dfu-mode/) for more information. - - - - - -