Fix Sleep/Wake on Hackintosh: Editing AGPM for Radeon HD 7870
Guide to editing AppleGraphicsPowerManagement.kext on High Sierra/Sierra to fix sleep/wake panics on Radeon HD 7870 Hackintosh. Step-by-step plist edits and testing.
When you inject AppleGraphicsPowerManagement (AGPM) into an Ivy Bridge Hackintosh running macOS 10.13.6, the default plist entries for a Radeon HD 7870 often cause kernel panics on wake from sleep. The kext’s built-in profiles were written for genuine Mac models, and mismatched GPU personalities produce incorrect voltage tables. Editing AGPM is the only reliable way to restore stable sleep/wake on unsupported configurations without disabling power management entirely. This guide covers the precise workflow for modifying the AGPM kext on High Sierra and Sierra, focusing on the plist structure, IOKit personality matching, and validation steps that prevent data loss.
Understanding AGPM and Its Role
AGPM controls GPU power states (P-states) and voltage transitions during idle, load, and sleep transitions. On a real Mac, the kext reads a set of per-machine and per-GPU profiles from /System/Library/Extensions/AppleGraphicsPowerManagement.kext/Contents/Info.plist. When you build a Hackintosh, the SMBIOS value (e.g., iMac14,2) tells AGPM which profile to load. If the GPU isn’t one of the models Apple paired with that SMBIOS, the kext either fails to load or applies wrong voltages. The result: sleep works but wake triggers a KP, or the system never enters deep sleep.
Editing AGPM involves copying the plist, modifying the IOKitPersonalities dictionary to match your GPU’s vendor and device ID, and adjusting the Control and Vendor sub-dictionaries. You then replace the kext (or use a Clover kext inject) and rebuild caches. This is safe only if you have a backup of the original kext and a working recovery environment.
The Anatomy of AGPM plist
Open the Info.plist in Xcode or PlistEdit Pro. The top-level key IOKitPersonalities contains multiple dictionaries, each named after a Mac model (e.g., Mac-00BE6ED71E35EB86 – the board ID for iMac14,2). Inside each board ID dictionary you’ll find:
- Vendor – a dictionary keyed by GPU vendor (e.g.,
ATY,AMDorNVDA,NVIDIA). - Control – a dictionary with parameters like
Heuristic,BoostPState,BoostTime, andLogPerformanceStatistics. - Vendor sub-dictionary – contains
GFX0andPEG0keys with further P-state arrays.
For most AMD GPUs (pre-Polaris) you will edit the ATY,AMD vendor section. The GFX0 array lists supported device IDs. If your GPU’s device ID (e.g., 0x6819 for Radeon HD 7870) is missing, AGPM ignores the profile entirely.
Identifying Your GPU's IOKit Personality
Before editing, you need the exact device ID and the IOKit personality name that AGPM uses. Boot your Hackintosh and run IORegistryExplorer (version 2.1). Search for AGPM under the root. Expand the tree until you see an entry named AGPM under your GPU’s IOPCIDevice. The IOReg shows the IODeviceMemory and the vendor-id/device-id in hexadecimal. Write down the device ID (e.g., 0x68191002 – the last four hex digits are the device ID, the first four are vendor).
Also check which board ID your SMBIOS currently uses. You can find this in Clover Configurator or by running ioreg -l | grep board-id in Terminal. For example, iMac14,2 returns Mac-00BE6ED71E35EB86. That board ID must exist in the AGPM plist. If it doesn’t, you can copy an entry from a similar Mac model (e.g., iMac13,2 for Ivy Bridge) and rename the dictionary key to your board ID.
Editing AGPM for Radeon HD 7xxx/8xxx
Let’s walk through a concrete example: Radeon HD 7870 (device ID 0x6819) on an Ivy Bridge system using SMBIOS iMac14,2.
- Back up the original kext:
sudo cp -R /System/Library/Extensions/AppleGraphicsPowerManagement.kext ~/Desktop/AGPM_Backup - Copy the kext to your desktop:
cp -R /System/Library/Extensions/AppleGraphicsPowerManagement.kext ~/Desktop/ - Open
~/Desktop/AppleGraphicsPowerManagement.kext/Contents/Info.plistin a plist editor. - Locate the dictionary for your board ID (
Mac-00BE6ED71E35EB86). InsideVendor->ATY,AMD->GFX0look for the array ofDeviceIDstrings. Add0x68191002if missing. - Adjust the
Controldictionary: setHeuristicto5(or4for older GPUs),BoostPStateto0, andBoostTimeto0. These values disable aggressive boosting that can cause instability on non-Apple GPUs. - Under
Vendor->ATY,AMD->GFX0->PStates, you can optionally customize voltage and frequency tables. For most users, leaving the default P-states from a similar Mac (e.g., iMac13,2 with HD 7870M) works. Copy the entirePStatesarray from that board ID’sATY,AMDsection. - Save the plist.
- Install the modified kext:
sudo cp -R ~/Desktop/AppleGraphicsPowerManagement.kext /System/Library/Extensions/ - Repair permissions and rebuild cache:
sudo chown -R root:wheel /System/Library/Extensions/AppleGraphicsPowerManagement.kextthensudo kextcache -i / - Reboot.
Testing and Debugging
After reboot, verify AGPM is loaded: kextstat | grep AGPM. You should see com.apple.driver.AGPM with a nonzero load address. Test sleep by selecting Sleep from the Apple menu. Wait 10 seconds then wake with a keyboard or mouse. If the system wakes without a panic, run a longer test: sudo pmset sleepnow and wake after 30 seconds. Check console logs (Console.app) for any AGPM-related messages. Look for AGPM: GPU = ... lines that confirm the correct profile is being used.
If you still get a panic, boot with -v and capture the panic backtrace. Common causes:
- Wrong device ID in GFX0 array – double-check the hex string (must be lowercase, no spaces).
- Missing
PEG0entry – some systems require a PEG0 dictionary alongside GFX0. Copy from a working iMac13,2 entry. - Incorrect SMBIOS – if your board ID doesn’t match any entry, AGPM won’t load. You can force a board ID by adding
boot-args-agpmod? No, that’s for different kext. Instead, add a custom entry by duplicating a similar board ID dictionary and renaming it to your own board ID. - Conflicts with other power management kexts – disable
AppleIntelCPUPowerManagementorXCPMif you’re also editing CPU power management. For dual-CPU systems, the interaction between AGPM and ACPI can be more complex, as discussed in our update on Dual-CPU X99 Hackintosh Update: High Sierra, Clover r5123, and What to Watch For.
Common Pitfalls and Safe Practices
- Never edit the kext in /S/L/E directly. Always work on a copy and replace after testing. A broken AGPM kext can prevent booting; keep a backup on a separate partition or USB.
- Kext signing. On High Sierra and later, SIP must be disabled (
csrutil disablein Recovery) to replace system kexts. Re-enable SIP after testing if you prefer, but note that AGPM will then be reverted on OS updates. - OS updates. Every macOS update replaces the AGPM kext. You will need to re-apply your edits. Document your changes in a text file to speed up re-application.
- GPU compatibility. AGPM editing works best for AMD GPUs from the Radeon HD 6xxx/7xxx/8xxx era (pre-Polaris). For NVIDIA GPUs, AGPM often conflicts with Web Drivers; disabling AGPM entirely (by renaming the kext) may be safer.
After applying the patch, verify with kextstat | grep AGPM and test sleep/wake cycles from console. If you still see panics, check the IOReg match for AGPM under your GPU’s IOPCIDevice. A missing match means the plist entry wasn’t recognized – revisit the board ID and device ID formatting. Save your edited plist in a safe spot; every macOS update will overwrite it, so you’ll need to reapply the same changes. With the correct AGPM configuration, sleep/wake on a Radeon HD 7870 works reliably, turning a frustrating KP into a non-issue.
