Difference between revisions of "How to run MAC OS VM under KVM /qemu"

From vpsget wiki
Jump to: navigation, search
Line 2: Line 2:
 
We will show how  to runMAC OS Virtual Machine under KVM  /native qemu /
 
We will show how  to runMAC OS Virtual Machine under KVM  /native qemu /
 
This is only in educational purposes.
 
This is only in educational purposes.
 +
 +
We are using Cenots 8 OS . BUt this should also work for Cnetos7 (even easier as you can easily download dmg2img rpm for centos7 /rhel7 but at this moment you may only build it from sources for centos 8)
 +
For ubuntu there will be some differences but the overall process is similar.
  
 
First of all you need to build your qemu from sources.
 
First of all you need to build your qemu from sources.
Line 85: Line 88:
 
  10    001-36735    10.15.6  19G2006  2020-08-06  macOS Catalina
 
  10    001-36735    10.15.6  19G2006  2020-08-06  macOS Catalina
 
  11    001-36801    10.15.6  19G2021  2020-08-12  macOS Catalina  
 
  11    001-36801    10.15.6  19G2021  2020-08-12  macOS Catalina  
  Choose a product to download (1-11):  
+
Choose a product to download (1-11):  
 
   
 
   
 +
Choose 11 for example and it will download neccesary binaries.
  
 +
Next you need to convert dmg to img with dmg2img tool which currently have no rpm/binaries for centos 8 so we will git clone it from sources and build:
 +
 +
cd /opt
 +
git clone https://github.com/Lekensteyn/dmg2img.git
  
 
# mkdir build
 
# mkdir build

Revision as of 17:33, 13 August 2020

//DRAFT We will show how to runMAC OS Virtual Machine under KVM /native qemu / This is only in educational purposes.

We are using Cenots 8 OS . BUt this should also work for Cnetos7 (even easier as you can easily download dmg2img rpm for centos7 /rhel7 but at this moment you may only build it from sources for centos 8) For ubuntu there will be some differences but the overall process is similar.

First of all you need to build your qemu from sources. Even if you have qemu/libvirt already installed our custom build should not conflict with it.

Check qemu module:

lsmod | grep kvm

if not listed add:

modprobe kvm

If you installing on environment that already using qemu/libvirt yo uneed to know where is qemu located in order to do not affect it:

whereis qemu
qemu: /usr/share/qemu

OK go to /opt and download qemu sources:

git clone git://git.qemu-project.org/qemu.git
cd qemu
git submodule init
git submodule update --recursive
git submodule status --recursive
git checkout stable-4.2  #or check what stable version exist at this time

Make sure you enabled APPLESMC in Makefile. Add if not exists the next records in Makefile :

# Makefile for QEMU. 
CONFIG_NE2000_ISA=y
CONFIG_HPET=y
CONFIG_APPLESMC=y

You may also check all APPLE related settings like with search:

grep "APPLE" -r .

Install gcc if not exists:

yum install gcc

..And dev tools if not installed:

yum groupinstall "Development Tools" 

Add depencies:

yum install glib2-devel  glibc-utils zlib zlib-devel pixman-devel


OK next configure to build qemu to custom binary

./configure --prefix=/usr/bin/qemundi 
 # no need: Not sure it need but I've created the target build dir: 
 # mkdir /usr/bin/qemundi
make

Next make install:

make install

OK your custom qemu build shoiuld be located at /usr/bin/qemundi/.. Check version:

/usr/bin/qemundi/bin/qemu-system-x86_64 --version
 QEMU emulator version 4.2.50 (v4.2.0-2711-g29e0855c5a-dirty)
 Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

Next we will prepare MAC OS.

cd /opt
git clone https://github.com/kholia/OSX-KVM.git
cd OSX-KVM

Refer to the git README for actual steps https://github.com/kholia/OSX-KVM However we will show our way here.

fetch installer:

./fetch-macOS.py
#if you got error like /usr/bin/env no such file or directory most likely you have only python3 installed then try: 
# python3 fetch-macOS.py 
# or install python2

Select the MACOS version desired:

 #    ProductID    Version    Build   Post Date  Title
 1    061-26578    10.14.5  18F2059  2019-10-14  macOS Mojave
 2    061-26589    10.14.6   18G103  2019-10-14  macOS Mojave
 3    041-91758    10.13.6    17G66  2019-10-19  macOS High Sierra
 4    041-88800    10.14.4  18E2034  2019-10-23  macOS Mojave
 5    041-90855    10.13.5   17F66a  2019-10-23  Install macOS High Sierra Beta
 6    061-86291    10.15.3  19D2064  2020-03-23  macOS Catalina
 7    001-04366    10.15.4  19E2269  2020-05-04  macOS Catalina
 8    001-15219    10.15.5  19F2200  2020-06-15  macOS Catalina
 9    061-94403    10.15.6    19G73  2020-07-15  macOS Catalina
10    001-36735    10.15.6  19G2006  2020-08-06  macOS Catalina
11    001-36801    10.15.6  19G2021  2020-08-12  macOS Catalina 
Choose a product to download (1-11): 

Choose 11 for example and it will download neccesary binaries.

Next you need to convert dmg to img with dmg2img tool which currently have no rpm/binaries for centos 8 so we will git clone it from sources and build:

cd /opt
git clone https://github.com/Lekensteyn/dmg2img.git
  1. mkdir build
  2. cd build
  3. ../configure
  4. make