This guide is a simplified (if somewhat expanded) version of the section Fixing Shutdown/Restart found in Dortania's OpenCore Post-Install Guide.
I wrote this guide because I could not understand the steps in the original guide as they where written. It took me a lot of time, frusrtation, and trial-and-error to finally figure it out.
This is a combination of personal notes (in case I ever need to do this procedure again) and a guide for others who have the same difficulty I had in understanding the original guide.
When you select shutdown on your Hackintosh, the computer restarts instead.
According to the original guide the problem is that the USB controller is not getting the correct command to shut down. So we need to create a patch to send the correct command to the USB controller.
This patch is implemented in two parts:
- an SSDT file named FixShutdown-USB-SSDT.dsl that contains the correct shutdown command for our USB controller.
- an ACPI patch in the OpenCore config.plist file which will enable the use of the SSDT file.
You may also need to disable Power Nap in macOS System Preferences. (Actually, try this before adding this patch to Open Core. If you're lucky you may not need the patch).
The SSDT file must be edited with the correct "name" for our USB controller. So the first thing we need to do is figure out what that name is. (This "name" is properly called an ACPI path.)
Here's how to find the ACPI path of your USB controller:
- Boot your Hackintosh PC in Windows.
- Press the Windows Key and X (win+X) and from the menu select Device Manager.
- In the device manager, navigate to Universal Serial Bus Controllers.
- In that category, select the entry that has "controller" in its name. Right-click on it and select Properties.
- In the properties window, go to the Location Paths section and copy the data there (usually its the second line).
An example of what you'll probably see: ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)
The ACPI path is the text in parenthesis, so by leaving everything else out we get: _SB_PCI0XHC_
and we add full stops to separate the three elements: _SB_.PCI0.XHC_
This is the ACPI path we need for the SSDT file.
What to do if you have multiple USB controllers.
If in Device Manager -> Universal Serial Bus Controllers you see more than one entry with "controller" in its name, you will need to copy the ACPI paths for each one.
Here's how to edit your SSDT file:
Note: to edit (and compile) the SSDT file FixShutdown-USB-SSDT.dsl you will need to use the application MaciASL
- Open FixShutdown-USB-SSDT.dsl in MaciASL
- Look for
External (_SB_.PCI0.XHC_.PMEE
in the code and replace it with your USB controller's ACPI path (in this example withExternal (_SB_.PCI0.XHC_
). - Look for
\_SB.PCI0.XHC.PMEE = Zero
and replace it your USB controller's ACPI path (in this example with\_SB.PCI0.XHC = Zero
)
Note: You'll notice that the ACPI path in step 3 has some underscores (_) missing. I don't know the ACPI programming language so I'm not certain why the second instance of ACPI path differs from the first, but by mimicking the formatting of the original ACPI path the patch worked for me. If it does not work for you, try it with and without the underscores.
What to do if you have multiple USB controllers.
You'll probably need to copy the entire code and duplicate it inside the file, replacing the ACPI path for each USB controller you have. (Note: I haven't tested this. May not work).
After you finish editing the file, you need to select Save As... and save the file with the format ACPI Machine Language Binary. (It has the name extension .aml instead of .dsl).
Then you are ready to move the newly edited .aml file into your ACPI folder. I'm going to assume you know where that folder is located.
Afterwards, you'll need to add to the FixShutdown-USB-SSDT.aml entry into the ACPI -> Add section of the config.plist file so that Open Core knows its there.
Fortunately, this is much simpler than the SSDT file. You don't need to adjust the ACPI patch. Just apply it as is.
Open your config.plist file in a plist editor and copy the contents of the FixShutdown-Patch.plist file into it.
While you have the OpenCore config.plist file open, don't forget to add the FixShutdown-USB-SSDT.aml in the ACPI -> Add section.
When finished, the relevant sections of your config.plist file should look something like this:
Finally, for the patch to work you may need to change some power settings in System Preferences. The one that seems to affect the system shutdown is Power Nap. If your computer still restarts at shutdown, try disabling Power Nap in both the Battery and the Power Adapter sections.
Note: you can also disable Power Nap from the terminal with the command sudo pmset powernap 0
If you did all of the above but still haven't managed to solve the issue, I'm afraid I can't be of much help. I have no real technical knowledge of ACPI. I suggest you ask for help from the Hackintosh SubReddit community.