Jump to content

OSX-KVM: Difference between revisions

m
imported>Wineee
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[https://github.com/kholia/OSX-KVM OSX-KVM] allows to run macOS on Linux machines.
[https://github.com/kholia/OSX-KVM OSX-KVM] allows to run macOS on Linux machines.


Use the following <code>shell.nix</code> to get all the tools required to boot OSX-KVM:
== Installation ==


<syntaxHighlight lang=nix>
Enable virtualisation support in your system configuration by adding following lines
with import <nixpkgs> {};
mkShell {
  buildInputs = [
    qemu
    python3
    iproute2
  ];
}
</syntaxHighlight>
 
On NixOS also add the following lines to your <code>configuration.nix</code>:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{
{
  # this is needed to get a bridge with DHCP enabled
   virtualisation.libvirtd.enable = true;
   virtualisation.libvirtd.enable = true;
  # Replace <youruser> with your actual username.
   users.extraUsers.youruser.extraGroups = [ "libvirtd" ];
   users.extraUsers.<youruser>.extraGroups = [ "libvirtd" ];


  # reboot your computer after adding those lines
   boot.extraModprobeConfig = ''
   boot.extraModprobeConfig = ''
     options kvm_intel nested=1
     options kvm_intel nested=1
Line 32: Line 18:
</syntaxHighlight>
</syntaxHighlight>


After cloning the repository use <code>./fetch-macOS.py</code> or <code>./fetch-macOS-v2.py</code> as described in the README
Replace <code>youruser</code> with the user name of your running system. After applying the configuration, reboot your system so the changes to the kernel modules can take effect.
to download macOS
Then do:


<syntaxHighlight lang=console>
== Usage ==
$ qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
</syntaxHighlight>


to create the base image containing the macOS installer, followed by creating
{{Note|This instruction uses a custom fork of OSX-KVM with Nix Flake support. Hopefully these changes will soon be merged to the upstream repository.}}
your actual disk image where later the macOS will be installed to:


<syntaxHighlight lang=console>
Git clone the project repository and run <code>nix run</code> to prepare and run your MacOS system
$ qemu-img create -f qcow2 mac_hdd_ng.img 128G
</syntaxHighlight>


Last but not least, configure a tap interface that will be used in macOS for networking:
<syntaxHighlight lang=bash>
 
git clone -b flake https://github.com/onny/OSX-KVM.git
<syntaxHighlight lang=console>
cd OSX-KVM
$ sudo ip tuntap add dev tap0 mode tap
nix run
$ sudo ip link set tap0 up promisc on
$ sudo ip link set dev virbr0 up
$ sudo ip link set dev tap0 master virbr0
</syntaxHighlight>
 
Then boot the system with:
 
<syntaxHighlight lang=console>
$ ./OpenCore-Boot.sh
</syntaxHighlight>
</syntaxHighlight>


Line 67: Line 37:


On the next boot you will a new boot entry containing the actual installation.
On the next boot you will a new boot entry containing the actual installation.
== See also ==
* [https://github.com/ngi-nix/OSX-KVM ngi-nix/OSX-KVM]: This implementation is based on [https://github.com/foxlet/macOS-Simple-KVM macOS-Simple-KVM], and may not be as complete or polished as [https://github.com/kholia/OSX-KVM kholia/OSX-KVM]. Usage instructions are available in the repository README.
[[Category:Virtualization]]
trusted
602

edits