Repository navigation
Fix 'Operation not permitted' on USB drives + verbose log (supersedes #3) - #4
Merged
Merged
Conversation
macOS refuses raw opens of /dev/rdiskN (even as root) unless the app has Full Disk Access. Raw disk access now goes through Apple's authopen with one pre-authorized AuthorizationRef for the disk and its partitions, so a single password dialog covers the whole job and no Full Disk Access is needed. The helper runs as the user; only macOS installer jobs still use a root helper. - CBootKit: authopen descriptor passing (SCM_RIGHTS) - DiskAuthorization: one dialog per disk, actionable error when the app runs from a privacy-protected folder - FATFormatter: FAT12/16/32 and exFAT written in-process (newfs_* cannot open authopen devices), validated with fsck_msdos / fsck_exfat - HFS+ via diskutil eraseVolume Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Hashim Khan <sardarhashim30@gmail.com>
…er output capture
Hashim1999164
marked this pull request as ready for review
October 17, 2026 16:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #3: it contains #3's commits plus the fixes below.
The bug
Pressing START with a Windows ISO (GPT / UEFI non-CSM / FAT32) failed with "Could not open /dev/rdisk9: Operation not permitted".
Cause: on
mainthe helper was started as root throughosascript … with administrator privilegesand opened/dev/rdisk9with plainopen(). Since macOS 10.15, a raw disk open is refused withEPERM, even for root, unless the responsible app has Full Disk Access, so the very first step (writing the partition table inDiskPreparer.partition) failed. Running the app from the Desktop makes authorization even less reliable.What changed
Disk access (from #3, reviewed and fixed)
/dev/diskN//dev/rdiskN[sM]open in the pipeline goes throughRawDevice. That covers partitioning, the re-probe, formatting, PBR, Syslinux, bad blocks, DD and save-image. OnEPERM/EACCESit falls back to Apple's/usr/libexec/authopen, as balenaEtcher and Raspberry Pi Imager do. You get one password dialog per job and don't need Full Disk Access. The helper now runs as the user; only macOS installer jobs still run as root.newfs_*can't use the authorized descriptor. Unmounting, mounting and ejecting usediskutil, which needs no raw device access. Copying and splittinginstall.wimwithwimlibwrite to the mounted volume, not the raw device.FATFormatter.dosDateTime: "unable to type-check this expression in reasonable time"), so its CI was red.Clear permission errors
BootKitError.permissionDeniedreplaces the rawEPERM/EACCEStext with numbered steps: move the app to /Applications, enter the password, grant Full Disk Access, close other apps using the drive. authopen exit statuses are mapped:EBUSYgets its own message.AppLocationdetects when the app runs from Desktop, Documents, Downloads,/Volumesor an App Translocation path. The main window then shows an orange banner with Show in Finder, and the warning is also logged.newfs_udf,mkntfsormke2fshit a permission error, the message suggests FAT32/exFAT. File-copyEPERMerrors point to Files and Folders › Removable Volumes.diskutil mountfalls back to the default mount point if the private one is refused for a non-root user.Verbose log
open()with its errno, the device geometry, andauthopeninvocations with exit status and fdAuthorizationCreate/AuthorizationCopyRightsOSStatus valuesdiskutil/hdiutil/wimlibcommand with its exit status and stdout/stderr (all of it on failure, the last 6 lines on success)helper-output.logand are tailed into the log as[helper output]. Timestamps now have millisecond precision;JobEventdates use milliseconds.~/Library/Logs/RufusAdvanced/RufusAdvanced-<date>.log. The last 20 launches are kept, with full detail whatever the switch says.Testing
LoggingTests(log format, ms round-trip, shell exit/stdout/stderr logging, permission messages, EACCES mapping, log file, DOS date, authopen right names). Disk-image end-to-end tests: 8 passed.DiskEngineTestsandJobEndToEndTestsrun in parallel and grab the samediskN. This was already the case before this PR; the step iscontinue-on-error.How to test on a Mac
Turn on Verbose in the Log pane, pick the USB stick and the Windows ISO, choose GPT / UEFI (non CSM) / FAT32, then START. Enter your Mac password when asked. If it fails, click Save… in the log pane, or send the newest file in
~/Library/Logs/RufusAdvanced/.Follow-up: show the finished drive in Finder
JobSpec. The stored setting is reset to off once, through theejectDefaultOffMigratedflag.diskutil mountDisk diskNand retries for up to 20 s, until a volume is mounted under/VolumeswithoutMNT_DONTBROWSE.JobEvent.driveState(ejected:mountPoints:)event reports this to the app.--ejectejects the drive,--no-mountleaves it unmounted.finishedDriveIsMountedForFinder, plus unit tests for the new defaults. CI: 44 unit and 9 disk-image tests pass.