Skip to content

About

Enhanced version of the original disk Encrypter script

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

DiskEncryption 2.0 "Enhanced"

  • Version: 2.4.13
  • Date: December 3, 2026
  • Compatibility: macOS 15+ (Sequoia) and macOS 26+

What's New in 2.4.13

  • When encryption or conversion fails, the notice now says what actually happened to the disk: read-only again, taken offline, or that protection could not be confirmed and it should be ejected. Before, it always said "read-only again".
  • "Taken offline" is now checked, and a partly converted HFS+ disk is found again before it is protected.
  • Enforcement runs within seconds of a Disk Encrypter Access exception being revoked or expiring, and every 5 minutes instead of 15. The LaunchDaemon changed, so install the package.
  • Enforcement no longer reruns every 10 seconds while anything writes to an external disk; it starts when a disk is mounted.
  • The logs are rotated at 1 MB, keeping 5 compressed copies.

Full notes: RELEASE-NOTES-2.4.13.md.

What's New in 2.4.12

  • Camera cards (ExFAT/FAT/NTFS) and HFS+ disks get their dialog again; in 2.4.11 they were protected but no dialog appeared.
  • A card ejected because it stayed busy is reported correctly, with a "Disk unmounted to protect your data" notice. Built-in SD card slots report eject as a failure even when it works.

Full notes: RELEASE-NOTES-2.4.12.md.

What's New in 2.4.11

2.4.11 fixes security issues in 2.4.6 and earlier; upgrade every Mac. Older releases are superseded and shouldn't be deployed.

  • Every unencrypted removable disk is made read-only within seconds, even at the login window or while a dialog is open. Read-only is confirmed, and busy disks are retried.
  • The encryption password goes to diskutil on standard input, must be typed twice, and is no longer shortened when it contains " : ". The default minimum is 8 characters.
  • Clearer dialogs: one at a time, on top, with a camera-card warning, a 15-minute timeout, and one "Encryption started" notice.
  • swiftDialog is no longer downloaded by default; deploy it with your MDM.
  • The installer replaces the old manual install and verifies the running daemon. The LaunchDaemon changed, so install the package rather than copying the script.
  • New read-only SimpleMDM checks in inventory/. The old erase-capable script and manual installer were removed.

Full notes: RELEASE-NOTES-2.4.11.md. Earlier versions and the detailed per-build history: CHANGELOG.md.

Known issues

  • An HFS+ volume on a disk with an MBR partition scheme can't be converted to APFS, so it can't be encrypted in place. Back up its files and erase the disk as APFS (Encrypted) in Disk Utility.

Repository Contents

DiskEncrypterEnhanced/
├── DiskEncrypter_Enhanced-NO-ERASE.sh     # Enforcement script (installed as DiskEncrypter_Enhanced.sh)
├── com.custom.diskencrypter.plist         # Example managed-preferences settings
├── packaging/                             # Installer package: LaunchDaemon, log rotation, pre/postinstall, build script
├── tests/                                 # Shell tests (run: /bin/bash tests/test-enforcement-state.sh)
├── inventory/                             # Read-only SimpleMDM checks (start with check-enforcement-status.sh)
├── docs/                                  # Design notes (native migration options)
├── uninstall_launchdaemon.sh              # Removes the daemon, script and receipt
├── RELEASE-NOTES-2.4.12.md                # Notes for the current release
├── RELEASE-NOTES-2.4.11.md                # Security release notes (fixes since 2.4.6)
├── CHANGELOG.md                           # Earlier versions and per-build history
└── Disk Encrypter Access/                 # Optional exception app and helper

The old erase-capable v2.3 script (DiskEncrypter_Enhanced.sh) and the manual installer (install_launchdaemon.sh with com.custom.diskencrypter.volumewatcher.plist) were removed in 2.4.11. They installed outdated code with known security issues. Install with the package instead; it also removes the old manual install's LaunchDaemon if it finds one.

The repository also includes Disk Encrypter Access, a SwiftUI administrator tool for one-volume, audited, time-limited writing exceptions. Its signed privileged-helper workflow is separate from the shell-only installation steps below.

Release tracks

DiskEncrypter and Disk Encrypter Access share the protected exception-state contract, but they are versioned and released independently:

Component Release tags Current release Purpose
DiskEncrypter installer 2.4.6, 2.4.11, 2.4.12, 2.4.13, … 2.4.13 Installs the enforcement script and LaunchDaemon.
Disk Encrypter Access access-v0.1.0, access-v0.1.1, … access-v0.2.1 Optional signed macOS app for one audited, time-limited, UUID-specific write exception.

Install DiskEncrypter before using the Access app. The Access app does not replace or globally unload the enforcement daemon.

Quick Start Installation

Install with the installer package from Releases. It installs LaunchDaemon com.custom.diskencrypter (/Library/LaunchDaemons/com.custom.diskencrypter.plist).

Macs set up with the old manual installer have LaunchDaemon com.custom.diskencrypter.volumewatcher instead. The package stops and removes that job when it installs. To see which a Mac has:

ls /Library/LaunchDaemons/ | grep diskencrypter

1. Settings (optional)

Deploy settings as a configuration profile for the preference domain com.custom.diskencrypter; com.custom.diskencrypter.plist in this repository is an example. Without a profile the built-in defaults are used. Deploy swiftDialog with your MDM as well: automatic download is off by default.

2. Install the package

Check the package's SHA-256 against the release notes, then install it with your MDM (Munki, SimpleMDM) or locally:

sudo installer -pkg DiskEncrypter_Enhanced_v2.4.13.pkg -target /

The package installs the script and LaunchDaemon, removes an old manual install's job, clears a disabled override, starts the daemon and confirms it is running the installed script. It defers while a Disk Encrypter Access exception is active.

3. Verify Installation

sudo launchctl list | grep diskencrypter

You should see com.custom.diskencrypter. If you see com.custom.diskencrypter.volumewatcher, the Mac still has the old manual install; install the package to replace it. Use sudo — without it, launchctl list doesn't show system daemons.

4. Monitor Logs

# View main log
tail -f /var/log/diskencrypter.log

# View error log
tail -f /var/log/diskencrypter_error.log

Key Features

Safer Handling of Unencrypted Volumes

  • in v.2.4.2 and above there is no erase option (NO_ERASE version of the script)
  • instructions for erasing after backups only

Automatic Encryption Enforcement

  • Automatically detects unencrypted external drives and mounts as read-only (v.2.3)
  • Prompts users to encrypt, eject or keep mounted as read-only (Encrypt and erase option only in v.2.3)
  • Supports APFS, HFS+, ExFAT/FAT/NTFS volumes

Smart Volume Handling (v2.2)

  • Skips read-only volumes - won't re-prompt for volumes already mounted read-only
  • Skips unmounted volumes - ignores volumes that aren't currently mounted
  • Prevents duplicate prompts - when new volumes appear, previously handled volumes are automatically skipped

User Options

  1. Encrypt - Convert and encrypt the volume with user-provided password (Note: in v2.3 exFAT, FAT and NTFS volumes will be erased. Make sure your data is backed up if you choose this option)
  2. Keep Read-Only - Keep the volume in read-only mode (all un-encrypted volumes are automatically re-mounted as read-only)
  3. Eject - Unmount and eject the volume

Advanced Features

  • Dry-run mode for testing
  • Configurable log levels (0-3)
  • AC power requirement for encryption
  • SwiftDialog integration for user notifications
  • Multi-volume summary
  • Automatic log rotation

Configuration

Edit /Library/Managed Preferences/com.custom.diskencrypter.plist to customize:

Key Settings

<!-- Enable dry-run mode (no actual operations) -->
<key>dryRun</key>
<string>no</string>

<!-- Log level: 0=minimal, 1=normal, 2=verbose, 3=debug -->
<key>logLevel</key>
<integer>1</integer>

<!-- Enable user notifications -->
<key>notifyUser</key>
<string>yes</string>

<!-- Password requirements -->
<key>passwordRegex</key>
<string>^[^\s]{4,}$</string>

Command Line Usage

The script can also be run manually with options:

# Test without making changes
sudo /Library/Application\ Support/Custom/DiskEncrypter_Enhanced.sh --dry-run

# Run with verbose logging
sudo /Library/Application\ Support/Custom/DiskEncrypter_Enhanced.sh --log-level 2

# Combine options
sudo /Library/Application\ Support/Custom/DiskEncrypter_Enhanced.sh --dry-run --log-level 3

Options

  • -d, --dry-run - Test mode (no actual disk operations)
  • -l, --log-level LEVEL - Set log level (0-3)
  • -h, --help - Show help message

Uninstallation

sudo bash uninstall_launchdaemon.sh

Works for both the installer package and the old manual install. This will:

  • Unload the LaunchDaemon (either label) and clear any disabled flag
  • Remove the LaunchDaemon plist(s), the log rotation rule, the installed script and the package receipt
  • Archive log files, rotated ones included, to ~/diskencrypter_logs_<timestamp>/

Settings in /Library/Managed Preferences/ are left in place, since they may be managed by MDM.

Troubleshooting

Check if daemon is running

sudo launchctl list | grep diskencrypter

Manual daemon control

These use the installer package label, com.custom.diskencrypter. For the old manual install, use com.custom.diskencrypter.volumewatcher and its plist instead.

# Status ("Could not find service" = not loaded)
sudo launchctl print system/com.custom.diskencrypter

# Stop for the current boot session
sudo launchctl bootout system/com.custom.diskencrypter

# Keep stopped across reboots (not needed for a short writing exception)
sudo launchctl disable system/com.custom.diskencrypter

# Re-enable after a persistent disable, then start
sudo launchctl enable system/com.custom.diskencrypter
sudo launchctl bootstrap system /Library/LaunchDaemons/com.custom.diskencrypter.plist

Starting the daemon runs the script immediately (RunAtLoad) against every mounted volume — eject any drive you don't want it to act on first.

Temporarily write to an unencrypted disk

Use this procedure only for a deliberate, short-lived exception. Stopping the daemon does not change a disk that DiskEncrypter has already mounted read-only; the volume must be unmounted and mounted again after the daemon is confirmed stopped.

First, identify the volume and its parent physical disk. Replace the fictional identifiers below with the values shown by diskutil list external physical:

diskutil list external physical
VOLUME_ID="diskXsY"
PHYSICAL_DISK="diskX"

Stop the installer-package daemon and confirm it is no longer loaded:

sudo launchctl bootout system/com.custom.diskencrypter
sudo launchctl print system/com.custom.diskencrypter

The second command should report Could not find service. If it still prints service details, stop here; do not remount the unencrypted volume while DiskEncrypter remains active.

Remount only the intended volume and verify that it is writable:

diskutil unmount "$VOLUME_ID"
diskutil mount "$VOLUME_ID"
diskutil info "$VOLUME_ID" | grep -E "Media Read-Only|Volume Read-Only"

Both read-only fields should report No. If either reports Yes, do not write to the disk until the cause is understood. A hardware write-protect switch, unsupported filesystem, damaged filesystem, or another policy can also make a volume read-only.

When the write is complete, eject the physical disk before restarting DiskEncrypter:

diskutil eject "$PHYSICAL_DISK"
sudo launchctl bootstrap system /Library/LaunchDaemons/com.custom.diskencrypter.plist
sudo launchctl print system/com.custom.diskencrypter

The final command should print the loaded service. Because the plist uses RunAtLoad, restarting DiskEncrypter immediately scans all mounted volumes.

For a Mac still on the old manual install (removed in 2.4.11), substitute these values throughout the stop, status and start commands, or better, install the package:

Setting Installer package Old manual install
LaunchDaemon label com.custom.diskencrypter com.custom.diskencrypter.volumewatcher
LaunchDaemon plist /Library/LaunchDaemons/com.custom.diskencrypter.plist /Library/LaunchDaemons/com.custom.diskencrypter.volumewatcher.plist

launchctl bootout is the appropriate temporary control: the plist remains installed and will load again after bootstrap or the next reboot. Avoid launchctl disable for a short exception because its disabled state persists across reboots.

Check logs

# Main log
cat /var/log/diskencrypter.log

# Error log
cat /var/log/diskencrypter_error.log

# System log
log show --predicate 'process == "DiskEncrypter"' --last 1h

Test manually

# Dry-run mode to test without changes
sudo /Library/Application\ Support/Custom/DiskEncrypter_Enhanced.sh --dry-run --log-level 3

File Locations

Component Location
Script /Library/Application Support/Custom/DiskEncrypter_Enhanced.sh
LaunchDaemon (installer package) /Library/LaunchDaemons/com.custom.diskencrypter.plist
LaunchDaemon (old manual install, removed in 2.4.11) /Library/LaunchDaemons/com.custom.diskencrypter.volumewatcher.plist
Settings /Library/Managed Preferences/com.custom.diskencrypter.plist
Main Log /var/log/diskencrypter.log
Error Log /var/log/diskencrypter_error.log
Log Archives /var/log/diskencrypter_archives/

Requirements

  • macOS 15+ (Sequoia) or macOS 26+
  • Full Disk Access permission
  • Root/administrator privileges
  • AC power for encryption operations
  • swiftDialog, deployed by your MDM (automatic download is off by default)

Support

For issues or questions, check the logs first:

tail -100 /var/log/diskencrypter.log
tail -100 /var/log/diskencrypter_error.log

License

© 2022 Thijs Xhaflaire

Credits

Created by: Thijs Xhaflaire in 2022 Enhanced: December 2025

About

Enhanced version of the original disk Encrypter script

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages