Patrik Nusszer's programming blog

Hackintosh with Clover

;

Introduction in abstract

In this article you are going to read about how to build a so called "Hackintosh" which means the installation of OS X on a machine that's not an Apple product. The possibility of this lies in the fact that software is always built for hardware. There are many languages... C#, C++, Java, F# and so on... Would you think that when you buy your PC it includes features for running software built in each of these languages? No. There are hundreds of languages, but there's in fact only one. What does it mean? That, in whatever language you write your application, when you are executing it its code it will be translated to assembly instructions. Yes, assembly. That is, the only language your processor can understand. The question comes, are there multiple types of assembly? Yeah, there are. And different processors can understand different ones. The thing that enabled projects to launch OS X installers was the point when Apple decided to put Intel processors inside its machines, and so it needed to compile their software for that assembly which is understood by Intel processors. Previously, OS X was built for PowerPC processors, but there was this switch to Intel, so theoretically and practically it is possible to run OS X on almost any machines, PCs that have Intel inside. But of course, I am not cleverer than this: you need tools in order to do this in practise. So follow this article if interested in how to deliver a plan of setting up a Hackintosh.

In practise

So I'll be straightforward. It is very easy to create a bootable USB drive from which you can boot the OS X installer and boot the opsystem itself. To be concrete, I'll be using OS X El Capitan 10.11.6 as an example. What you will need:
- A running OS X
- A version of an OS X El Capitan installer
- An USB drive larger than 7-8 GB
- The execution of a terminal application which is found inside the installer of the copy of OS X El Capitan that will create a bootable installer on the mentioned USB drive
- The installation of Clover on the same USB drive
- Adding FakeSMC.kext and your own kexts to a given library created by Clover installation
- Running Clover configurator or Multibeast to modify the SMBIOS entry inside file config.plist that is also a file created during the installation of Clover. SMBIOS defines what type and how old Mac you have. It is essential because the installer verifies whether your "Mac" is eligiable to run the OS X version. This step can be skipped by adding boot flag "-no_compat_check" when booting. In this case, your SMBIOS won't be verified.
- Manually edit the mentioned config.plist file and add an inject nvidia entry if your nvidia graphics card is too old.
- Manually edit the config.plist to make sure it will inject your kexts.

If you are done with these, your USB is ready to boot. Now let's go into the details

Prenotice

As it's mentioned in the previous pharagraph, you DO need a running OS X in order to do the whole process.

Obtaining OS X El Capitan

You can download the newest version from the App Store or one by torrent. In fact that's it. Though you may have troubles downloading the installer. A typical error is when you see that the download has started, but you can't see the installer app in the Applications folder. In this case, you will need to boot in safe mood. In Clover, for this, add boot flag "-x". It is foolproof. You can always download the installer this way. Make sure Clover injects your ethernet kext because many of the non-injected kexts are disabled in safe mode. If Mac App Store says "This version of OS X is not supported the platform" or stuff like that, the Mac you are using is actually an old model, or your SMBIOS settings show an old model. In this case, just modify it. If the message is "Your device or computer could not be verified. Contact support for assistance." then you either need a valid SMBIOS setting or ethernet. Once the thing that solved this problem for me was that I used An USB wifi adapter to connect, but it wouldn'T work with that, and using ethernet was the solution.

Creating the bootable USB drive

Plug in your USB drive (larger than 8 GB) and open Disk Utility.app.
Select the USB drive itself not the partition, and click "Partition". Select "Mac OS X Extended (Journaled)", GUID Partition Table is automatically preselected, that's not needed to be chosen by you. Let the partition be "USB", any name you give, it will be overwritten. Then apply it, and wait until the process is done.
Now you are ready to run the command that will create the installer on the just partitioned disk.
In the following command, I'm going to refer to the "USB" named partition by NAME_OF_USB, as the name itself is up to you in fact
Having the installer with name "Install OS X El Capitan.app" in your Applications folder, run the following command in terminal:
"sudo /Applications/"Install OS X El Capitan.app/Contents/Resources/createinstallmedia" --volume "/Volumes/NAME_OF_USB" --applicationpath "/Applications/Install OS X El Capitan.app" --nointeraction".
You'll see: "Erasing disk: 0%... 10%... 20%... 30%... 100%...".
When, done, you'll see: "Copying installer files to disk...".
This will take a long time, then after doing some other quick tasks it will complete.
You are not ready yet: you must install Clover bootloader.

Installing Clover

Download the latest version of Clover from: https://sourceforge.net/projects/cloverefiboot/
Extract, and launch the .pkg file. If you are installing in legacy mode, you do NOT need to add any additional options, you do not need to "customize the installation". Otherwise, you may customize your installation, and check "Install Clover in the ESP", "Install for UEFI booting only", and sometimes it fixes errors if you check "Drivers64UEFI/OsxAptioFix2Drv-64". Then click install, but do not forget to check teh install location. Firstly it will suggest installation on your hard disk; but we want to install it on your USB stick, so select that one.

After Clover: config.plist

If you chose legacy installation, open the USB drive, and open directory "EFI/CLOVER". If you chose the UEFI installation, you'll see a partition named as "EFI". Open it then locate directory "CLOVER".
Having these done, you'll see a file called config.plist. Now we are going to make manual modifications to it, sorry, but I won't tell you about software solutions, I think it is more important for you to understand how things work low level.
So open it up, and search for "<key>SMBIOS</key>". If you found it, insert the stuff down here into the <dict>COMES_HERE</dict> tags that belong to the SMBIOS key, otherwise if you could not find it, create one: "<plist version="1.0"><dict> KEY_DICT_CONTENT_HERE</dict>": this is the structure of the file.
Right under in the KEY_DICT_CONTENT_HERE insert:
"<key>SMBIOS</key><dict>SMBIOS_STUFF_COMES_HERE</dict>"
In the SMBIOS_STUFF_COMES_HERE insert:
"<key>BiosReleaseDate</key>
<string>06/12/13</string>
<key>BiosVendor</key>
<string>Apple Inc.</string>
<key>BiosVersion</key>
<string>MP61.88Z.0116.B04.1312061508</string>
<key>Board-ID</key>
<string>Mac-F60DEB81FF30ACF6</string>
<key>BoardManufacturer</key>
<string>Apple Inc.</string>
<key>BoardType</key>
<integer>11
<key>ChassisAssetTag</key>
<string>Pro-Enclosure</string>
<key>ChassisManufacturer</key>
<string>Apple Inc.</string>
<key>ChassisType</key>
<string>06</string>
<key>Family</key>
<string>Mac Pro</string>
<key>Manufacturer</key>
<string>Apple Inc.</string>
<key>Mobile</key>
<false/>
<key>ProductName</key>
<string>MacPro6,1</string>
<key>SerialNumber</key>
<string>F5KM5HWDF694</string>
<key>Trust</key>
<false/>
<key>Version</key>
<string>1.0</string>"

This will do. The system definition of MacPro6.1 will be eligible for macOS Sierra too.
HINT: The rule is: <key>NAME</key><dict>STUFF_BELONGING_TO_NAME</dict>
According to this, locate key "SystemParameters", or create it if not present.
Into the dict tags belonging to it, insert:
"<key>InjectKexts</key>
<true/>"
<key>InjectSystemID</key>
<true/>"

This will make sure the kexts that we WILL in the followings add to Clover will be injected on every boot.
If your NVidia graphis card is a very old one, you'll also need one more key:
Locate key "Graphics", then into the <dict></dict> tag belonging to it insert the following:

"<key>Inject</key>
<dict>
<key>ATI</key>
<false/>
<key>Intel</key>
<false/>
<key>NVidia</key>
<true/>
</dict>"

This will enable you to launch the installer with backwards NVidia graphic cards too.
In fact That's all we need to do to the config.plist file.

config.plist summary

In the followings I'm going to summarize what must exist inside the config.plist file:

"<key>Graphics</key>
<dict>
<key>Inject</key>
<dict>
<key>ATI</key>
<false/>
<key>Intel</key>
<false/>
<key>NVidia</key>
<true/>
</dict>
</dict>
<key>SMBIOS</key>
<dict>
<key>BiosReleaseDate</key>
<string>06/12/13</string>
<key>BiosVendor</key>
<string>Apple Inc.</string>
<key>BiosVersion</key>
<string>MP61.88Z.0116.B04.1312061508</string>
<key>Board-ID</key>
<string>Mac-F60DEB81FF30ACF6</string>
<key>BoardManufacturer</key>
<string>Apple Inc.</string>
<key>BoardType</key>
<integer>11</integer>
<key>ChassisAssetTag</key>
<string>Pro-Enclosure</string>
<key>ChassisManufacturer</key>
<string>Apple Inc.</string>
<key>ChassisType</key>
<string>06</string>
<key>Family</key>
<string>Mac Pro</string>
<key>Manufacturer</key>
<string>Apple Inc.</string>
<key>Mobile</key>
<false/>
<key>ProductName</key>
<string>MacPro6,1</string>
<key>SerialNumber</key>
<string>F5KM5HWDF694</string>
<key>Trust</key>
<false/>
<key>Version</key>
<string>1.0</string>
</dict>
<key>SystemParameters</key>
<dict>
<key>InjectKexts</key>
<true/>
<key>InjectSystemID</key>
<true/>
</dict>"

That's all additional you need in the config.plist file.

Adding kexts

The Windows equivalent for a kext is a driver. It creates connection between software and hardware.
There is a MUST HAVE kext for every Hackintosh user without which nothing would work, and this is: FakeSMC.kext. You may also need VoodooPS2Controller.kext for PS/2 keyboard and mouse support, VoodooHDA.kext for audio, and a PCI dependent driver for ethernet. Google these for yourself, I only provide link to FakeSMC.kext.
Here it is: http://adf.ly/1kQvHO.
And here are found the official links for different versions of FakeSMC.kext: https://bitbucket.org/RehabMan/os-x-fakesmc-kozlek/downloads/
Having your kexts in place, open the EFI/CLOVER folder, and locate directory "kexts". So the path is: "EFI/CLOVER/kexts".
Here you'll find directories of names of different version numbers of OS X. Yes, guessed it, you'll need to copy and paste your kexts into the directory "10.11" in case of OS X El Capitan, but for securing, and making things sure, also paste your kexts into the "other" folder.

Your first boot

Having all these done, you are theoretically done with EVERYTHING. Yes, your USB drive is ready to be booted.
Enter your BIOS settings, and set your USB as your startup drive, and it will boot. You should see a list of drives into which you can boot. Choose the installer partition, and you are good to go.

Your first installation

When booted into the installer successfully, select Disk Utility and format the drive where you want to install OS X as "Mac OS X Extended (Journaled)", name it for example "MacintoshHD", and select GUID Partition Table if not preselected.
After this, you can proceed to install the OS. The next time you boot into the USB drive, you are ready to boot from the drive where you have just installed OS X. All done.

Possible errors

When booted into the installer successfully, and selected to install macOS Sierra, you may stuck at the logo.
If you boot in verbose mode with the "-v" boot flag, and see a line of plus signs, it might mean that your processor does not support SSE4, which, as it is a hardware level problem, has no workaround than going into the shop and buying a new processor that supports SSE4.1 or SSE4.2. This is what I know, as it was my problem.
Now I'm buying an Intel Core 2 Duo E7500 that supports SSE4.1. It's a cheap solution, but if you want something stronger, you can choose Intel Core 2 Quad Q8200 and up. (Q6700 has no support for SSE4 yet for example, but Q8300, Q8xxx have). But do not forget to check what processors does your motherboard support!
Here's the link where you can find the list of Intel Core 2 processors, and there you can see which supports SSE4.1: https://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors