Okay, so imagine for a moment
that I am a long time Mac user.
I know it's a bit of a stretch,
but just bear with me for a second here.
Now, imagine that I've been putting off an upgrade for years
because I just don't like what Apple's done
with their pro hardware.
What with the soldering all the components
and minimal upgradeability.
What am I to do?
Well, I can just use old hardware
that's losing support,
or I can cobble together a hopefully compatible bundle
of components to build a Hackintosh
that even if it works perfectly today
is liable to be borked by a future macOS update.
But those options suck.
Fortunately, I've got one of these.
And Anthony, and he comes bearing another way.
So come along with us
because we are gonna be using the power of virtualization
to build the no compromises and fully upgradable Mac Pro.
And it looks like this.
What?
Before we get started,
there are a few requirements we need to meet.
We need to have a dedicated graphics card.
Is that NVIDIA?
Yup.
Ooh, spicy.
We'll also need a USB controller
that we can pass through our virtual machine
for hot plug support.
We'll need to access to a real Mac.
Got it.
Cool.
And finally, although this might seem obvious,
we'll need a computer.
One with virtualization, both supported and enabled.
Intel calls this VTD and VTX
and AMD calls this SVM for secure virtual machine.
That's what we'll be using today.
Wait, so we're gonna be running Ryzen 2?
Not bad, love it.
It's even spicier.
Yeah, but before we can do that,
we'll need to install Linux.
Specifically one with QEMU 3.1 or newer.
We used Manjaro because as a rolling release distro,
its packages are typically more up-to-date,
but you might prefer something lighter like Arch
if you intend to ignore your Linux install
and use your machine purely as a Mac.
Regardless of the distro,
you'll need the following software.
Libvirt, QEMU, OVMF, and Virtual Machine Manager
via our Package Manager.
So in Manjaro's case, that would be PAMAC.
PAMAC?
I think it's PAMAC, Package Manager.
Cool.
Then what we'll need to do is enable the KVM server,
and then we'll need to do is enable the KVM server,
which for us can be achieved by firing up a terminal
and typing these two commands.
But I'm sure you're thinking to yourself,
come on Linus, it can't be that simple.
Surely Apple thought of virtual machines
and locked down their OS in some way
to keep this from working.
And well, of course they did.
Yeah, but thanks to some really amazing work
by the team over at Pass Through Post,
there's finally a workaround.
It is a little bit tedious,
but if you follow the steps carefully,
it shouldn't take you more than an hour or two
to do this at home.
So first, we'll fire up the Linux terminal
and type git clone,
and paste the URL for the Hackintosh KVM repository,
which will give us a folder
with most of the files that we'll need.
The last two that we'll need are ovmf__code.fd
and ovmf__vars.fd from Kolya's OSX KVM Git repository.
So as you guys can see,
we are really getting into the weeds now.
Our next step is then relatively simple,
but the most legally problematic.
See, downloading macOS is technically free.
You just fire up the app store here,
but only if it's going to be used
according to the end user license agreement from Apple.
So on a real Mac.
Which means that technically,
everything we do from this point on is piracy.
Which means that whether or not
you were to actually deploy a solution like this
is up to your personal moral compass
and your risk tolerance.
So using our Mac,
we're gonna download and run
DOSDUDE1's High Sierra Patcher tool
to download and create our installation media.
Go ahead and fire this up here
from an unknown developer.
Beware.
Yeah, we know.
So we get this little error that says
your machine is natively supported by High Sierra.
You don't need to use this patch.
One of the other purposes of this patch
is running the latest macOS software
on outdated Macs that Apple no longer supports.
Anyway, that's fine.
We knew that.
So all we do is go down into tools,
download macOS High Sierra,
and then we're gonna save that file
to the applications folder.
Once that's done,
we just copy the create ISO High Sierra file
over to our flash drive so we can bring it over to our Mac.
Got it.
Then we launch a Mac terminal
and navigate to the folder containing that file.
Before we run it though,
we'll set the executable flag by typing this command
and hitting enter.
And then after that,
we type dot slash create underscore ISO
underscore High Sierra dot sh
and hit enter again.
The process will begin automatically.
And once it's done,
we're going to have a bootable High Sierra ISO
on our Mac's desktop,
which we will then copy,
back onto our USB over to our Linux machine.
I mean, we could copy it over the network as well.
We could.
I mean, we do have that 10 gigabit network.
This seems simpler right now.
Yeah.
While we wait,
we can set up our VM on our Linux host.
So inside the Hackintosh KVM folder
is a sub folder called example XML files,
containing two files,
helpfully labeled for AMD and Intel users.
We're running Ryzen.
So we'll copy the AMD file
to the root of the Hackintosh KVM folder.
And rename to something more useful like hackintosh.xml.
Now at the time of writing,
this file is partially corrupt.
So Anthony is going to need to fix it
by opening it in a text editor,
scrolling to the very bottom
and typing slash domain to finish the file.
And then by removing all of the value equals dash object lines
and their subsequent input lines,
because those are actually specific to the author's
computer,
not to us.
Ours.
Now that that's done,
we can get back on track here.
So at the top of the file,
we want to edit the loader and the NBRAM lines
to point to files that we got from Coleus Git earlier.
Then we can save and close the file.
So it's ready to import.
Yeah.
So I've got virtual machine manager right here.
You can see that there's nothing there,
but if I go into our Hackintosh folder
and do ver.sh,
define,
hackintosh.
There it is.
Our Hackintosh VM.
So from here,
it's a GUI interface.
So we can just open this puppy up
and we can configure our Hackintosh
however it is that we want.
We can set our CPU core assignments,
allocate however much memory we think we need
and set up our storage media.
So in this case,
we're going to be booting from an NVMe SSD.
One thing to watch out for here,
every CPU is different,
but for Ryzen 7,
assigning eight cores in sequence from one to eight
gives us exactly one CCX,
which produces the on-chip communication overhead
for better performance.
Now next, in order to actually boot this thing,
we'll need to add a virtual hard drive
and point it to the clover.qcow2 file
in our Hackintosh KVM folder.
And we'll also need to add a virtual optical drive loaded
with the High Sierra ISO that we created earlier.
And theoretically,
we are finally ready to install macOS.
Before we pass the boot screen though,
we're going to need to hit escape
to go into the firmware settings
and change the resolution to 1920 by 1080.
This is the resolution that our Clover bootloader
is set to use.
And we're going to get garbled graphics
if we don't change the setting.
Once Clover is booted,
we'll choose the macOS installer
and everything from here on out should be
as though it was on a real Mac, theoretically.
It'll take a minute.
Is that it?
Yeah.
That's it.
That's it?
A functional macOS desktop on AMD Ryzen
and oh my God, it's slow.
It's very laggy.
Yeah.
So we can fix that.
Cool.
It's just, it's got all the patches and drivers we need
except for our display.
Right.
But are we ready to install that yet?
No.
No. Okay.
Great.
But wait.
There's more.
So first we need to download and install Clover
to our main storage media.
We can then copy the configuration
from the Hackintosh KVM Clover image and leave it as is,
or we can use it as a starting point for more customization.
So using a tool called Clover Configurator,
you can actually do all kinds of fun things
like modify the boot screen and edit your serial number
to get access to FaceTime and iMessage, et cetera, et cetera.
Now, this is the point where we say goodbye
to our slow built-in graphics
and switch over to our dedicated card here.
So what we'll need to do is shut down our VM
and then open up its configuration
in Virtual Machine Manager,
where we will manually fully pass through this GPU.
So this is actually a GTX 1070 over here
that's separate from the RTX 2060 that Linux is running on.
While we're at it, we can also pass through a USB controller
so that we can hot plug USB devices within our VM.
Now, if your motherboard has multiple USB controllers on it,
like an Intel one and an As Media one,
you may be able to do this without a separate add-in card.
Otherwise, macOS compatible USB cards
are available for just a few bucks.
In order to make this work though,
we're gonna need to edit a couple of system files,
starting with etc slash default
slash grub to tell Linux which devices,
like which parts of the hardware here
it should leave available for us to pass through
and to enable support for splitting our devices
into IOMMU groups that can be passed through to a VM.
Now we're back in the command line
and in both sections here,
we're gonna add AMD underscore IOMMU equals on
and VFIO dash PCI dot IDs equals
followed by the IDs of the devices
that we want to pass through,
which we can then check by loading up a terminal
and typing LSPCI dash NN and then looking for the devices.
That's our Turing, there we go.
That one right there is our GPU
and then the HDMI audio device
that should be right under it
is the audio controller for our GPU.
Now, before you fully commit to this,
you may want to run this command to check and see
if your IOMMU groups
are separated correctly.
If not, you're gonna wanna try different PCI express slots,
like maybe ones connected directly to the CPU
instead of the chip set,
which some other boards will have labels for,
or else it'll be in the manual.
If that fails, you can look into ACS overrides,
but let me tell you,
that was an absolute nightmare
when I was trying to figure out six workstations, one CPU,
and even then it ultimately didn't solve the problem.
And we had to switch to a different motherboard,
and we had to make sure that it worked out right.
So before undertaking a project like this,
I'd recommend seeing
how well your board handles virtualization.
Some vendors do it better than others,
and some models do it better than others.
Now, because Linux is using the video card
and USB controller we need,
we had to do a system reboot.
Now we can go back to virtual machine manager,
remove our temporary display adapter,
double check that these devices you pass through
are actually the right devices, and boot it up.
Okay.
Double check here, just moving everything over.
Theoretically.
Okay.
This is now a Mac, and this is a Linux PC.
And they're both running off of this same box
with half the CPU allocated to each
and one graphics card for each.
We might want to go in.
Oh yeah, that's this again.
Got to change our boot order.
Can't control, delete, do it.
Oh, nope.
So this was unexpected.
This has never happened in a Linus Tech Tips video before.
We actually had some technical difficulties,
and for some reason,
it was not letting us select 1080p over here
with the NVIDIA card passed through.
So that's fine.
We just took it off, put back the garbage drivers.
And then what we're going to do
is install the NVIDIA web driver ahead of time
so that when we boot up with the NVIDIA card,
it's ready to rock.
So all we need is a handy little script
over at Benjamin Dobell's NVIDIA-Update Git repository,
which will grab the best NVIDIA driver
for our macOS version.
Then we reboot.
Okay.
So let's try that again.
We should be good to go now.
Now, it may do that weird thing again.
It does.
It did.
Yep.
That's a good way to use a computer.
Like this.
A little window right there.
Human vision is like, you know, it's wide, man.
It's not tall, man.
So we got, oh, we're back to 16 by nine.
Like a, like a loser.
Like a loser running an AMD processor.
With a higher performance graphics card
than you can currently buy in a Mac,
which I actually don't know is technically true
because we were going to run this with a 1080 TI.
Whatever the point is, don't worry about it.
We could be running a 1080 TI in macOS
with GPU acceleration.
This is something else.
Ah, there we go.
Blah, blah, blah, blah.
Holy shit.
Ryza.
Take that, apple.com.
Yeah, you like that?
Oh, show me your Mac option with Ryzen.
Do you have one?
Do you have one like that?
Oh, oh, you don't.
You don't have one like that, huh?
Wow, what a bummer.
Yeah, it's a real bummer.
Maybe they can put something in the Mac Pro.
Now, there is more you can do to improve performance,
like setting up the VM
to use statically assigned memory pages,
pinning and isolating CPU cores,
and bypassing pulse audio on the host.
And if you don't plan on using Linux for anything,
making your machine just boot macOS at startup.
You can also get FaceTime and iMessage running
as we alluded to before,
but it seems to be a bit of a hit or miss thing.
So that might be a project for another day.
And actually, I mean, I think that's a perfect place
for us to sign off here
because I think we've accomplished
what we set out to do today.
And while we can go much deeper,
honestly, I'd like to kind of make this up to the audience,
what they want to see us do with this,
because here's the thing.
You guys got to understand because this is a VM,
just like two gamers, one CPU, seven gamers, one CPU,
all those projects, it will run on any hardware.
That was part of the reason that an NVIDIA GPU
and AMD CPU was chosen
because those are specifically things
along with the chip set here
that are not supported by Apple,
like not even weird bootleg drivers
that people ripped out of macOS and whatever,
like they are not supported.
So we can run this on like a Threadripper
or a Xeon W3175X with a Titan XP and huge amounts of memory.
So with this method, we could basically create the Mac
that Apple fans can currently only dream of,
one that doesn't thermal throttle.
For now though, honestly,
after everything that especially you went through,
I'm happy this thing is just running at all.
So maybe let us know in the comments, guys,
do you wanna see us take a fatter machine
for a spin with this method?
Maybe like a Hackintosh versus loaded up iMac Pro
for content creation benchmark,
or maybe like Linux versus Mac versus Windows gaming
all at the same time on the same box.
I mean, I don't know.
The possibilities are kind of endless here.
So thanks for watching guys.
If this video sucked, you know what to do,
but if it was awesome, get subscribed, hit that like button,
or check out the link to where to buy the stuff
we featured in the video description.
Also down there is our merch store,
which has cool shirts like this one
and our community forum, which you should totally join.