How to Remove OCLP-Mod Patches from the System Volume: Complete Unpatch Guide
OCLP-Mod removes patches by reverting the APFS snapshot created during the original patch installation, automatically restoring the system volume to its pre-patch state without requiring manual file deletion.
The OCLP-Mod project (laobamac/oclp-mod) provides a robust system patching framework for macOS. When you need to remove OCLP-Mod patches from the system volume, the tool leverages APFS snapshot technology to ensure complete and safe restoration.
How OCLP-Mod Removes Patches: The Snapshot-Based Approach
Unlike traditional uninstallers that manually delete files, OCLP-Mod uses APFS snapshot reversion as its core removal mechanism. When patches are first applied, the system creates a snapshot of the volume. During removal, bless --last-sealed-snapshot restores the system to that exact state, causing any files written, merged, or overwritten during patching—including the oclp-mod.plist patch-set descriptor—to disappear automatically.
Step-by-Step OCLP-Mod Patch Removal Process
The unpatch workflow is triggered via the public PatchSysVolume.start_unpatch() method in oclp_mod/sys_patch/sys_patch.py.
1. Verify System Un-Patchability
Before any changes occur, HardwarePatchsetDetection checks the can_unpatch property. If the current system cannot be safely un-patched, the operation aborts immediately to prevent system instability.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 600–610)
2. Mount the Root Volume
The root volume is mounted read-write using RootVolumeMount to enable snapshot operations.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 613–617)
3. Revert the APFS Snapshot
APFSSnapshot.revert_snapshot() executes bless --last-sealed-snapshot (or performs a no-op on macOS versions earlier than Big Sur). This restores the system to the state before any patch files were written.
- Source:
oclp_mod/sys_patch/mount/snapshot.py(lines 56–69)
4. Clean Up Skylight Plugins
Any temporary SkyLightPlugins folder created during patching is removed, and a fresh empty folder is re-created to prevent orphaned graphics plugins.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 300–312)
5. Remove Non-Metal Enforcement Defaults
System defaults that forced OpenGL rendering (useMetal, useIOP) are deleted to restore native graphics behavior.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 314–326)
6. Clean Auxiliary Kernel Cache
Any auxiliary kernel cache created for newly-added kexts is removed via KernelCacheSupport.clean_auxiliary_kc().
- Source:
oclp_mod/sys_patch/kernelcache/support.py(lines 110–115)
7. Reset Spotlight UI Flags
On macOS Tahoe and newer, the SpotlightUI.plist flag is reset to the default true value.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 404–408)
8. Log Completion and Request Reboot
The user is informed that the un-patch is finished and that a system restart is required for the changes to take effect.
- Source:
oclp_mod/sys_patch/sys_patch.py(lines 390–395)
Programmatically Removing Patches with start_unpatch()
You can trigger patch removal programmatically using the PatchSysVolume class:
# Example: programmatically invoking an un-patch
from oclp_mod.sys_patch import sys_patch
# `constants` is the global OCLP-Mod configuration object already created by the app
unpatcher = sys_patch.PatchSysVolume(
model=constants.computer.real_model,
global_constants=constants,
hardware_details=None, # optional – detection runs automatically
)
# Run the un-patch routine
unpatcher.start_unpatch()
Running the above on a machine that has previously been patched will:
- Mount the system volume as read-write.
- Revert the snapshot created by the original patch.
- Perform the cleanup steps listed above.
After the log messages appear, a system restart is required for the system to boot from the restored snapshot.
Key Source Files for OCLP-Mod Patch Removal
| File | Role in Un-patching |
|---|---|
oclp_mod/sys_patch/sys_patch.py |
Contains start_unpatch(), the mounting logic, and the core _unpatch_root_vol() routine that orchestrates the revert and cleanup. |
oclp_mod/sys_patch/mount/snapshot.py |
Implements APFSSnapshot.revert_snapshot() which restores the pre-patch snapshot. |
oclp_mod/sys_patch/kernelcache/support.py |
Provides KernelCacheSupport.clean_auxiliary_kc() used to wipe auxiliary kernel caches created for patched kexts. |
oclp_mod/sys_patch/sys_patch_helpers.py (indirect) |
Supplies helper methods for Skylight plugin removal and non-Metal enforcement cleanup. |
oclp_mod/support/arguments.py |
Exposes a CLI entry point that ultimately calls PatchSysVolume.start_unpatch(). |
These files together define the complete, snapshot-based removal strategy that OCLP-Mod uses to cleanly uninstall system-volume patches.
Summary
- OCLP-Mod removes patches by reverting APFS snapshots rather than manually deleting files, ensuring complete restoration of the system volume.
- The
PatchSysVolume.start_unpatch()method inoclp_mod/sys_patch/sys_patch.pyorchestrates the entire removal workflow. - Snapshot reversion via
APFSSnapshot.revert_snapshot()restores the volume to its exact pre-patch state, automatically eliminating patch files and theoclp-mod.plistdescriptor. - Post-revert cleanup includes removing Skylight plugins, non-Metal enforcement defaults, and auxiliary kernel caches.
- A system reboot is mandatory after unpatching for the restored snapshot to become active.
Frequently Asked Questions
What happens to files created during patching when I remove OCLP-Mod patches?
Because OCLP-Mod uses APFS snapshot reversion to remove patches, any files written, merged, or overwritten during the original patching process—including the oclp-mod.plist patch-set descriptor—disappear automatically when the snapshot is restored. This eliminates the need for explicit file-removal code and ensures no orphaned patch files remain on the system volume.
Is a reboot required after removing OCLP-Mod patches?
Yes, a system restart is mandatory after the unpatch process completes. While PatchSysVolume.start_unpatch() reverts the APFS snapshot and performs cleanup operations immediately, the system must reboot for the restored snapshot to become the active boot volume. The unpatcher logs completion and explicitly requests the user to restart the machine.
Can I unpatch a system that won't boot using OCLP-Mod?
If the system cannot boot normally, you cannot run the standard unpatch workflow from within the affected macOS installation. Instead, you must boot from macOS Recovery, an external bootable volume, or another macOS installation where you can mount the affected system volume and run OCLP-Mod's unpatch routines against that mounted volume.
Where is the patch removal logic implemented in the OCLP-Mod source code?
The primary patch removal logic resides in oclp_mod/sys_patch/sys_patch.py within the PatchSysVolume class, specifically the start_unpatch() method and its helper _unpatch_root_vol(). The actual snapshot reversion is handled by APFSSnapshot.revert_snapshot() in oclp_mod/sys_patch/mount/snapshot.py, while auxiliary kernel cache cleanup is managed by KernelCacheSupport.clean_auxiliary_kc() in oclp_mod/sys_patch/kernelcache/support.py.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →