Apple won't like this... - Run MacOS on ANY PC

Linus Tech Tips ·Linus Tech Tips ·2019-05-06 · 2,931 words · ~14 min read
Floatplane YouTube

Transcript

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