How To: Run SpinRite on an Apple Silicon Mac (Part 1 of 2)

  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in please checkout the “Tips & Tricks” page for some very handy tips!

    /Steve.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)

Scott

Well-known member
Sep 18, 2020
176
43

This How To article is in two parts:​

  1. Part 1 - Introduction, creating external boot drive, installing QEMU and it's prerequisites (this article)
  2. Part 2 - Setting up your virtual boot drive, copying SpinRite to it, and running SpinRite via QEMU against your Mac drives

Part 1 of 2​

Big Caveat!!!​

I have barely tested this!! All seems to work but please, please, please backup your data, and potentially be ready to completely wipe the machine and reinstall MacOS from scratch. Also, huge, huge caveat:
I have only run this on my Intel Mac. Silicon Macs should work identically (as QEMU will emulate instead of virtualize when run on ARM / Silicon Mac) but I haven't tested it!! The blog post noted below from Ryan Spletzer notes that he has run this on Apple Silicon.

Comments from users who have tested this would be welcome
Update: One user so far has reported success on an Apple Silicon Mac using these instructions

Introduction​


As has been noted previously, the FreeDOS OS and SpinRite itself only run natively on PCs with Intel or AMD CPUs. Additionally, the firmware for those machines must be of the older BIOS type, or UEFI-based but able to go into Legacy (aka CSM) mode. Most PCs built since 2019, and Macs built since about 2015, can't go into Legacy mode, and are thus unable to run SpinRite natively.

Instructions have already been posted for:
  • Running SpinRite natively on older Intel Macs, and
  • Running SpinRite via Virtualization on newer, UEFI-only Intel or AMD PCs and newer UEFI Intel Macs
The remaining common PC architectures that have not had solutions for them are ARM-based:
  • Apple Silicon Macs
  • ARM-based Windows PCs
I now believe that thanks to CPU emulation (not virtualization), these last two types of machines can run SpinRite in the emulation environment provided by the open source software package QEMU. This post will outline the steps needed to run SpinRite on Apple Silicon-based Macs via QEMU.

I didn't come up with this approach, I just combined what I read from others with some of the instructions I already provided for virtualization. The first posting of someone doing this successfully that I saw was here: https://www.spletzer.com/2024/12/running-spinrite-on-apple-silicon/ . Kudos to Ryan Spletzer for documenting this!!

While you can use this approach for Intel-based Macs and Intel/AMD PCs, I'd stick with the VirtualBox virtualization solution as it's a bit simpler. But it is an option; when running on an Intel or AMD CPU, QEMU will default to virtualization rather than emulation.

The overall steps to make this work are:
  1. Create a bootable external USB drive running MacOS
  2. Boot the target Mac from that drive
  3. Within MacOS:
    1. Install the XCode Command Line Tools
    2. Install the Homebrew Package Manager
    3. Use Homebrew to install QEMU
  4. Create a FreeDOS Disk Image in which to run SpinRite, and install SpinRite to that Disk Image
  5. Ensure that the internal drives of the host machine are UNMOUNTED, so that the actual OS does not interfere with SpinRite operations
  6. Map the actual physical drives of the target Mac to virtual drives via the QEMU command line
  7. Run SpinRite, which should now see those drives as attached the Emulated PC created by QEMU

Caveats​

My testing so far has only been able to emulate IDE controllers, not AHCI controllers, although QEMU supposedly supports them. This will probably limit the number of simultaneous drives one can connect to an emulation session to four total.

What kind of drives can SpinRite in QEMU "see"?​

The physical drives are virtualized and accessed through the QEMU emulated drive controllers and/or "BIOS"; any drive that the Host OS can see can be mapped in QEMU, and then addressed by SpinRite.
  • When drives are attached to the virtual IDE controller, SpinRite accesses them through its native IDE driver
My testing with QEMU has been limited. Under VirtualBox, I know that SpinRite can access drives larger than 2.2 TB; I haven't tested that yet for QEMU. Additionally, I've only tried mapping a SATA attached drive, though any drive visible to MacOS should be accessible to SpinRite under QEMU.

USB drives must be physically attached (and the OS-specific unmount commands run) before running QEMU. There is no need for the USB mapping capability within QEMU.

Prerequisites​

There are certain items you need in order to make this work:
  • One USB drive to run the "host OS" and VirtualBox. This could be a fast USB flash drive, but it's HIGHLY RECOMMENDED that you use an external USB SSD drive. Flash drives will quickly wear out and and slow down.
    • Capacity - should be at least 64 GB
  • And most importantly, these "items":
    • A SAFETY FIRST ATTITUDE!!
      • Before working on your target system, back it up!! Just like running SpinRite natively against a system, SpinRite on an emulated environment will rewrite data, so backup your data, just in case!
      • If running against an encrypted drive (FileVault on MacOS), print out your recovery key and store it safely!!
        • And if possible, temporarily turn off the encryption before running SpinRite against the drive
    • KNOWLEDGE!! You must be comfortable with Administration commands in both the Host OS of choice, as well as DOS and the QEMU application. You should NOT blindly follow this guide; you need to understand what the commands are; there is an assumption that you know your way around a Mac and PC. YOU ARE DOING THIS AT YOUR OWN RISK, AS IT IS AN UNSUPPORTED METHOD TO RUN SPINRITE. WHILE THE INSTRUCTIONS SHOULD ENSURE THAT THE DRIVES ARE UNDER EXCLUSIVE SPINRITE CONTROL, TESTING HAS NOT BEEN EXTENSIVE. DATA LOSS IS A POSSIBILITY!

Other notes:​

  • Booting from external drives seems to throw off the clock on many target systems. Before starting work, double check that the time zone and time are correct. When booting back to the native OS, do the same

On your Target Mac (on which you will eventually run SpinRite against its drives)​

A. Creating an external MacOS Boot Drive​

  1. Create an external, bootable MacOS drive
    1. There are plenty of websites explaining how to do this
    2. Here's a good example set of instructions:
  2. The only special settings needed are to ensure your Mac NEVER turns off its display, sleeps / suspends, or turns off (those are all related to power savings)
    1. Instructions vary depending on whether you're on a desktop or laptop, and version of MacOS
      1. Click on this link for the instructions for your particular MacOS version:
        1. Set sleep and wake settings for your Mac
      2. On MacOS Sonoma for my Mac laptop, I:
        1. Went to the Lock Screen settings and set:
          1. "Start Screen Saver when inactive" to "Never"
          2. "Turn display off on power adapter when inactive" to "Never"
        2. Went to the Battery settings and clicked the "Options" button
          1. "Prevent automatic sleeping on power adapter when the display is off" is turned "On"
          2. "Put hard disks to sleep when possible" set to "Never"
    2. You could also try a 3rd party utility to manage this; such as the app Amphetamine

B. Installing XCode Command Line Tools​

  1. First, check if the tools are already installed. If so, you can move on to installing Homebrew and then QEMU
    1. Follow the instructions here to see if the tools are installed: https://mac.install.guide/commandlinetools/2
  2. If not, then install the command line tools
    1. Follow the instructions here: https://mac.install.guide/commandlinetools/4
      1. Basically, it's just opening a terminal session and typing: xcode-select --install

C. Installing Homebrew​

Unfortunately QEMU does not provide a Mac installer. It will have to be installed via a 3rd party Mac package manager, such as Nix or MacPorts or Homebrew. I chose to use Homebrew but if you're comfortable with one of the others than use that.

I installed Homebrew by running the installer from the downloaded .pkg file, but you can run the command line noted on the Homebrew home page as well. After the installation, there is a message about adding homebrew to the Path to allow running from any directory.

D. Installing QEMU​

Per the Homebrew instructions for QEMU, you can simply open a Terminal window and type: brew install qemu

Continue on to Part 2 to get a base C drive for QEMU, put your copy of SpinRite onto that drive, and map the Mac drives onto QEMU for use by SpinRite​

 
Last edited: