First off, I am using macOS Mojave 10.14.6.

In this answer, it shows how one could manually set a firmware password in previous versions of OS X without any user input, excluding sudo, which is acceptable for my needs. (The answer itself uses user input, but one could simply use the setregproptool command by itself.

Here is my modified version of that code that I have updated for Mojave and tweaked to be used for my purposes.

# Mounts the Recovery disk (to access the Security Utility application)
sudo diskutil mount Recovery & wait

# In the recovery disk, there are various folders based on the current version of macOS. I need the latest version.
# So, I read the list of folders into an array ordered such that the most-recently modified is first and use regex to get the folder separately from the other folder information.
IFS=$'\n' read -rd '' -a ADDR <<< "$(ls -ltud /Volumes/Recovery/*)"
latestRecovery=$(grep -oE "(\w+-)+\w+\/" <<< "$latestRecovery")

# Using this most up-to-date folder, I get the path of and load the corresponding BaseSystem.dmg file.
hdiutil attach -quiet -nobrowse "$baseSystemPath" & wait

# Here, we attempt to change the firmware password.
sudo "/Volumes/macOS Base System/Applications/Utilities/Startup Security Utility.app/Contents/Resources/setregproptool" -m command -p <new-password> -o <old-password>

# Finally, we unmount the Recovery  disk
diskutil unmount force Recovery & wait

However, the execution of the setregproptool fails because, when loading BaseSystem.dmg and getting the path /Volumes/macOS Base System, this volume is loaded as a read-only file system.

So, my question would be answered by one of the following: a way to load BaseSystem.dmg as a readable and executable volume or an alternative way to change the macOS firmware password in a way that allows standard input. (e.g. somehow using firmwarepasswd that doesn't require user input apart from sudo.)


It seems that the problem with executing setregproptool is separate from the read-only disk since copying the "Startup Secuirty Utility.app" to my disk and attempting to execute the file still results in it failing.

By the way, the error it throws is as follows: sudo: unable to execute ./setregproptool: Operation not permitted

Another thing I tried just to get everything out of the way was to disable SIP. Also, just in case anyone suggests this, Terminal already has Full Disk Access.

Update 2:

After further questioning, It was found that I am unable to execute any binary on the macOS Base System volume, which may further contribute to the idea that the volume is being attached as a read-only volume.

Additionally, to add some more information, I do currently have a firmware password set.

Output of mount | grep Base: /dev/disk2s1 on /Volumes/macOS Base System (hfs, local, nodev, nosuid, read-only, noowners, quarantine, nobrowse, mounted by [redacted])

  • copy it to a r/w volume (e.g. /usr/sbin/) and remove it there after executing it.
    – klanomath
    Nov 23, 2019 at 20:24
  • @klanomath Interestingly enough, the file still failed to execute. I checked the chmod value, and it was set to 755. I also used chown to make myself the owner, and it still failed to execute. Nov 23, 2019 at 22:56
  • @GigiBayte2 I tested it just 5 min ago and I got the same error :-(
    – klanomath
    Nov 23, 2019 at 22:59
  • Running the command directly from base works if used to just check whether a password is set. So maybe the error comes from trying to write a new password, not from running it as such.
    – nohillside
    Nov 24, 2019 at 5:43
  • -readwrite is listed in the man page, need to do some further tests later. (edited "later": fails for me as well).
    – nohillside
    Nov 24, 2019 at 5:44


You must log in to answer this question.

Browse other questions tagged .