Runs macOS on linux with qemu.

Overview

mac-on-linux-with-qemu

License: MIT

Runs macOS on linux with qemu.

screenshot

Pre-requisites

  • qemu-system-x86_64
  • dmg2img
  • pulseaudio
  • python[click]

Usage

After cloning the repository, simply run ./run.sh

How it works

  • ./fetch-macos.py fetches macOS image dmg from their software update centre
  • The downloaded .dmg image is converted to .img using the dmg2img utility
  • We create a virtual disk image using ./create-virtual-disk.sh
  • We install macOS to qemu using the given image. ./install-macos.sh
  • We provide a custom launcher script to launch qemu with the correct settings. ./launch-macos.sh

Note

If you face any problem while installation, remove firmware/ and rename fallback-firmware/ to firmware/ Once installed, don't change the firmware files. Although they are automatically recovered by a installed system.

References

Comments
  • why big sur update cannot be completed ?

    why big sur update cannot be completed ?

    Big sur upgrade is proposed , downloaded and the first step install completed. But after reboot, it is as if nothing had happend and the system reboot as catalina os. Same thing for the last 2021-04 security update. I tried to change the external update process back to normal but no result.

    Is it possible to change the fetch-macos.py script instead and change the https://swscan.apple.com/content/catalogs/others/index-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog , to big sur dmg url instead , and remake a new fresh install ?

    Does anybody got the good Big Sur url ?

    bug 
    opened by tombombadilom 11
  • qemu-system-x86_64: Display 'sdl' is not available.

    qemu-system-x86_64: Display 'sdl' is not available.

    I ran the run.sh script but it shows an error. The output is :

    *** Checking for firmware files
    *** Checking for Base System files
    *** Check if dmg2img is available
    /usr/bin/dmg2img
    *** Check if BaseSystem dmg is downloaded. If downloaded convert to img
    *** BaseSystem dmg available.
    *** Check if BaseSystem dmg has been converted to img before.
    *** BaseSystem img available.
    *** Checking for disk image
    *** Check if installer has been run
    *** Looks like the install hasn't been done yet, lets install
    *** Install!
    qemu-system-x86_64: Display 'sdl' is not available.
    

    I am a beginner with linux so don't be too rude.

    opened by Alg0v 10
  • Archlinux After qemu and kernel upgrade I lost virtio-vga support

    Archlinux After qemu and kernel upgrade I lost virtio-vga support

    After qemu and kernel upgrade I lost the virtio-vga support

    too bad everything was going perfectly fine with mac os x

    [[email protected] mac-on-linux-with-qemu]$ ./launch-macos.sh
    qemu-system-x86_64: -drive if=pflash,format=raw,readonly,file=packaged-firmware/OVMF_CODE.fd: warning: short-form boolean option 'readonly' deprecated
    Please use readonly=on instead
    qemu-system-x86_64: -device virtio-vga,virgl=on: Property 'virtio-vga.virgl' not found
    

    dmesg | grep drm did not return pci:virtio-vga and in kernel virtio drivers it cannot be found either.

    [[email protected] /lib/modules/5.13.13-arch1-1/kernel/drivers/virtio$ ls
    virtio_balloon.ko.zst  virtio_input.ko.zst  virtio_mmio.ko.zst  virtio_pci_modern_dev.ko.zst
    virtio_dma_buf.ko.zst  virtio_mem.ko.zst    virtio_pci.ko.zst   virtio_vdpa.ko.zst
    

    normaly there should be no problem has I have this enabled

    [[email protected] tom]# zgrep VIRTIO /proc/config.gz
    CONFIG_BLK_MQ_VIRTIO=y
    CONFIG_VIRTIO_VSOCKETS=m
    CONFIG_VIRTIO_VSOCKETS_COMMON=m
    CONFIG_BT_VIRTIO=m
    CONFIG_NET_9P_VIRTIO=m
    CONFIG_VIRTIO_BLK=m
    CONFIG_SCSI_VIRTIO=m
    CONFIG_VIRTIO_NET=m
    CONFIG_VIRTIO_CONSOLE=m
    CONFIG_HW_RANDOM_VIRTIO=m
    CONFIG_DRM_VIRTIO_GPU=m
    CONFIG_SND_VIRTIO=m
    CONFIG_VIRTIO=y
    CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS=y
    CONFIG_VIRTIO_PCI_LIB=m
    CONFIG_VIRTIO_MENU=y
    CONFIG_VIRTIO_PCI=m
    CONFIG_VIRTIO_PCI_LEGACY=y
    CONFIG_VIRTIO_VDPA=m
    CONFIG_VIRTIO_PMEM=m
    CONFIG_VIRTIO_BALLOON=m
    CONFIG_VIRTIO_MEM=m
    CONFIG_VIRTIO_INPUT=m
    CONFIG_VIRTIO_MMIO=m
    CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
    CONFIG_VIRTIO_DMA_SHARED_BUFFER=m
    CONFIG_RPMSG_VIRTIO=m
    CONFIG_VIRTIO_FS=m
    CONFIG_CRYPTO_DEV_VIRTIO=m
    

    here are my libs versions

    [[email protected] mac-on-linux-with-qemu]$ pacman -Qs '^(linux|mesa|qemu|virglrenderer|libepoxy)$'
    local/libepoxy 1.5.9-1
        Library handling OpenGL function pointer management
    local/linux 5.13.13.arch1-1
        The Linux kernel and modules
    local/mesa 21.2.1-1
        An open-source implementation of the OpenGL specification
    local/qemu 6.1.0-1
        A generic and open source machine emulator and virtualizer
    local/virglrenderer 0.9.1-1
        A virtual 3D GPU library, that allows the guest operating system to use the host GPU to accelerate 3D rendering
    

    I wonder if there is something that i am missing ? if I have to downgrade version for qemu and/or kernel. Or compile a modified kernel .

    opened by tombombadilom 6
  • Freeze on Big Sur using the new ESP.qcow2 resolved

    Freeze on Big Sur using the new ESP.qcow2 resolved

    Freeze happend after a long time of unused. I first thought it was a suspend problem and deactivated all suspend:

    • from monitor
    • from max os
    • from linux

    But the problem remains... I've got no error log in Mac os X and for qemu juste a tiny :

    qemu : Slirp: Failed to send packet, ret: -1
    

    To let you know there this issue https://github.com/foxlet/macOS-Simple-KVM/issues/499 I found this very helpfull https://support.apple.com/en-en/guide/mac-help/mchlp1168/mac I just had to stop hard drive suspend to solve the problem

    opened by tombombadilom 5
  • Install macos failed

    Install macos failed

    Hi,

    i try to install macos with your script. I change in script install and launch macos the sdl for gtk with gl=off because i have the error with sdl not available. I chown tall he folder to not launch in root the run.sh

    All is OK but when the qemu launch his screen, i have the mac recovery screen. and i don't know what's wrong. In terminal the last line is "GTrace synchronization point f"

    Thank you, best regards

    opened by AS1244 3
  • xcode and usb iphone passthrough

    xcode and usb iphone passthrough

    How to add an iphone to use with xcode

    Références: https://stackoverflow.com/questions/67279997/connect-iphone-via-usb-to-sosumi-qemu https://github.com/sickcodes/Docker-OSX/issues/133

    Define usb port to be usb passthrough

    it is easier to select a usb bus where your iphone is single but in case you can't follow the udev rules

    plug your iphone to usb

    $ lsusb
    Bus 001 Device 004: ID 05ac:12a8 Apple, Inc. iPhone 5/5C/5S/6/SE
    

    Since qemu runs as a regular user, it cannot connect to hot-plug USB devices unless you change permssions on the host. Being in group plugdev might be sufficient for standard USD block devices. For others, such as an iphone, you need to manually change the /dev/bus/usb/xxx/yyy to group users or create /etc/udev/rules.d/97-iphone.rules.

    https://www.linuxquestions.org/questions/blog/kingbeowulf-74138/qemu-usb-passthrough-with-specifics-for-iphone-37830/

    sudo vim /etc/udev/rules.d/97-iphone.rules
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="*",GROUP="users", MODE="0660"
    

    0x05ac vendor ID in this case is for an Apple iPhone 5C. For iphones specifically, it can help to disable usbmuxd with an empty /etc/udev/rules.d/39-usbmuxd.rules Now, either reboot (ha! this ain't windows!) or run as root

    sudo udevadm control -R
    

    then edit yout lanch-mac-os.sh and add

    -usb \
    -device usb-ehci,id=ehci \
    -device usb-host,bus=ehci.0,vendorid=0x05ac,productid=0x12a8,guest-reset=false,id=iphone \
    

    Warning if you intend to code with xcode or upgrade your iphone with your mac , remove the productid . see comment below.

    Pairing an iOS device with Xcode

    • Open Xcode and go to Window > Devices and Simulators.
    • Plug your iOS device into your Mac using a lightning cable. You may need to select to Trust This Computer on your device.
    • Select your device and then select the Connect via network checkbox to pair your device:

    https://stackoverflow.com/questions/10087985/xcode-doesnt-see-my-ios-device-but-itunes-does

    Do I need to be a Apple Developer Member to deploy apps on my iphone ?

    https://developer.apple.com/forums/thread/81424

    when you launch your mac os x you should get this :

    [email protected] ~ % lsusb
    Bus 004 Device 002: ID 0627:0001 0627 QEMU USB Mouse  Serial: 89126-0000:00:04.0-3
    Bus 004 Device 003: ID 0627:0001 0627 QEMU USB Keyboard  Serial: 68284-0000:00:04.0-2
    Bus 004 Device 001: ID 05ac:12a8 Apple Inc. iPhone  Serial: 650d4ab950e8ece4cd07b637044440618c9080b4
    Bus 000 Device 001: ID 1d6b:IPCI Linux Foundation USB 2.0 Bus 
    Bus 000 Device 001: ID 1d6b:IPCI
    IPCI
    IPCI
    IPCI Linux Foundation USB 2.0 Bus
    
    documentation 
    opened by tombombadilom 3
  • qemu-system-x86_64: Display 'sdl' is not available.

    qemu-system-x86_64: Display 'sdl' is not available.

    Hi,

    I have tried to launch the script but I have the following error *** Checking for firmware files *** Checking for Base System files *** Checking for disk image *** Check if installer has been run *** Looks like the install hasn't been done yet, lets install *** Install! qemu-system-x86_64: Display 'sdl' is not available.

    Distributor ID: Linuxmint Description: Linux Mint 20.2 Release: 20.2 Codename: uma

    opened by vernichon 3
  • Cannot install, no disk found

    Cannot install, no disk found

    Hi,

    When the message "Select the disk where you want to install macOS" is displayed, there is no available disk.

    There is only one disk "macOS Base System" which is greyed. Cannont continue.

    OS : Ubuntu 20.04.3 LTS

    Capture du 2021-09-01 11-18-30

    opened by Olivier34 2
  • Question on resolution

    Question on resolution

    Hello, I wonder if i could get the same resolution as you have on the screenshot. In the settings of the virtual machine, i only get 1280x720, do you have any clue if i can get higher resolution ? Thanks Capture du 22-08-2021 21:21:18

    opened by flaviencrochard 2
  • Disk not found during install

    Disk not found during install

    I'm trying a fresh install. I can launch the installer, accept the license, but then there is only the disk "macOS base system" (2Go) marked "this disk is locked", and no other disk. I tried to delete all the files and restart, same result. Am I missing something?

    No error message in the logs.

    Nice work that I can get to this point!

    opened by Yamakaky 2
  • Bash strict mode

    Bash strict mode

    You should enable http://redsymbol.net/articles/unofficial-bash-strict-mode/ on every script. dmg2img was not installed so I got

    ./run.sh: line 12: dmg2img: command not found
    *** Checking for disk image
    *** Check if installer has been run
    *** Looks like the install hasn't been done yet, lets install
    *** Install!
    qemu-system-x86_64: -drive if=pflash,format=raw,readonly,file=packaged-firmware/OVMF_CODE.fd: warning: short-form boolean option 'readonly' deprecated
    Please use readonly=on instead
    qemu-system-x86_64: -drive id=InstallMedia,format=raw,if=virtio,file=BaseSystem/BaseSystem.img: Could not open 'BaseSystem/BaseSystem.img': No such file or directory
    
    opened by Yamakaky 2
  • OpenGL not supported

    OpenGL not supported

    Hello, I have a problem during the installation, do you have any solutions?

    Thanks in advance !

    [email protected]:/home/gaetan/Téléchargements/mac-on-linux-with-qemu-main# sudo ./run.sh
    *** Checking for firmware files
    *** Checking for Base System files
    *** Check if dmg2img is available
    /usr/bin/dmg2img
    *** Check if BaseSystem dmg is downloaded. If downloaded convert to img
    *** BaseSystem dmg available.
    *** Check if BaseSystem dmg has been converted to img before.
    *** BaseSystem img available.
    *** Checking for disk image
    *** Check if installer has been run
    *** Looks like the install hasn't been done yet, lets install
    *** Install!
    qemu-system-x86_64: OpenGL is not supported by the display
    

    PS: I've been looking for a solution for several hours but can't find a fix.

    opened by Gaetann18 5
Releases(1.1.0)
  • 1.1.0(Jul 6, 2022)

    What's Changed

    • Applied bash strictmode patch from github.com/flaviencrochard by @arindas in https://github.com/arindas/mac-on-linux-with-qemu/pull/10
    • Added the -vga std flag for virtual vga driver to support higher reso… by @arindas in https://github.com/arindas/mac-on-linux-with-qemu/pull/11
    • Updated ESP image. by @arindas in https://github.com/arindas/mac-on-linux-with-qemu/pull/18
    • Updated run.sh. by @arindas in https://github.com/arindas/mac-on-linux-with-qemu/pull/17
    • fixed to virtio-vga-gl by @tombombadilom in https://github.com/arindas/mac-on-linux-with-qemu/pull/28
    • Replaced sdl display with gtk display. by @arindas in https://github.com/arindas/mac-on-linux-with-qemu/pull/34
    • Sourcery Starbot ⭐ refactored arindas/mac-on-linux-with-qemu by @sourcery-ai-bot in https://github.com/arindas/mac-on-linux-with-qemu/pull/29

    New Contributors

    • @arindas made their first contribution in https://github.com/arindas/mac-on-linux-with-qemu/pull/10
    • @tombombadilom made their first contribution in https://github.com/arindas/mac-on-linux-with-qemu/pull/28
    • @sourcery-ai-bot made their first contribution in https://github.com/arindas/mac-on-linux-with-qemu/pull/29

    Full Changelog: https://github.com/arindas/mac-on-linux-with-qemu/compare/v1.0.0...1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jul 23, 2021)

    Release notes

    • Corrected exec invocation in bash scripts
    • Removed all traces of SNAP
    • Correctly handled firmware files. Firmware files prone to change on every boot are copied for user-specific use
    • Updated firmware file paths in bash scripts.
    Source code(tar.gz)
    Source code(zip)
Owner
Arindam Das
Specializes in Deep Learning model serving and AI SaaS at scale. Experienced in distributed system design, architecture, and deployment.
Arindam Das
Subscribe, listen and (in the future) download your favorite podcasts, quickly and easily.

Minimal Podcasts Player https://github.com/son-link/minimal-podcasts-player Subscribe, listen and (in the future) download your favorite podcasts, qui

Alfonso Saavedra 14 Nov 11, 2022
Nick Craig-Wood's Website

Nick Craig-Wood's public website This directory tree is used to build all the different docs for Nick Craig-Wood's website. The content here is (c) Ni

Nick Craig-Wood 2 Sep 02, 2022
Multi-Probe Attention for Semantic Indexing

Multi-Probe Attention for Semantic Indexing About This project is developed for the topic of COVID-19 semantic indexing. Directories & files A. The di

Jinghang Gu 1 Dec 18, 2022
Analisador de strings feito em Python // String parser made in Python

Este é um analisador feito em Python, neste programa, estou estudando funções e a sua junção com "if's" e dados colocados pelo usuário. Neste código,

Dev Nasser 1 Nov 03, 2021
"Hacking" the (Telekom) Zyxel GPON SFP module (PMG3000-D20B)

"Hacking" the (Telekom) Zyxel GPON SFP module (PMG3000-D20B) The SFP can be sour

Matthias Riegler 52 Jan 03, 2023
Python meta class and abstract method library with restrictions.

abcmeta Python meta class and abstract method library with restrictions. This library provides a restricted way to validate abstract methods. The Pyth

Morteza NourelahiAlamdari 8 Dec 14, 2022
- Auto join teams teams ( from calendar invite )

Auto Join Teams Meetings Requirements: Python 3.7 or higher Latest Google Chrome This script automatically logins to your account and joins the meetin

Prajin Khadka 10 Aug 20, 2022
Minitel 5 somewhat reverse-engineered

Minitel 5 The Minitel was a french dumb terminal with an embedded modem which had its Golden Age before the rise of Internet. Typically cubic, with an

cLx 10 Dec 28, 2022
The Python Achievements Framework!

Pychievements: The Python Achievements Framework! Pychievements is a framework for creating and tracking achievements within a Python application. It

Brian 114 Jul 21, 2022
Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories.

Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories. Setup This workflow requires a number of Python modules. Thes

Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 1 Oct 14, 2022
Project5 Data processing system

Project5-Data-processing-system User just needed to copy both these file to a folder and open Project5.py using cmd or using any python ide. It is to

1 Nov 23, 2021
Utility to play with ADCS, allows to request tickets and collect information about related objects

certi Utility to play with ADCS, allows to request tickets and collect information about related objects. Basically, it's the impacket copy of Certify

Eloy 185 Dec 29, 2022
Make your Discord Account Online 24/7!

Online-Forever Make your Discord Account Online 24/7! A Code written in Python that helps you to keep your account 24/7. The main.py is the main file.

SealedSaucer 0 Mar 16, 2022
EDF R&D implementation of ISO 15118-20 FDIS.

EDF R&D implementation of ISO 15118-20 FDIS ============ This project implements the ISO 15118-20 using Python. Supported features: DC Bidirectional P

30 Dec 29, 2022
Display your data in an attractive way in your notebook!

Bloxs Bloxs is a simple python package that helps you display information in an attractive way (formed in blocks). Perfect for building dashboards, re

MLJAR 192 Dec 28, 2022
Python Freecell Solver

freecell Python Freecell Solver Very early version right now. You can pick a board by changing the file path in freecell.py If you want to play a game

Ben Kaufman 1 Nov 26, 2021
The most widely used Python to C compiler

Welcome to Cython! Cython is a language that makes writing C extensions for Python as easy as Python itself. Cython is based on Pyrex, but supports mo

7.6k Jan 03, 2023
Sodium is a general purpose programming language which is instruction-oriented (a new programming concept that we are developing and devising) [Still developing...]

Sodium Programming Language Sodium is a general purpose programming language which is instruction-oriented (a new programming concept that we are deve

Instruction Oriented Programming 22 Jan 11, 2022
JimShapedCoding Python Crash Course 2021

Python CRASH Course by JimShapedCoding - Click Here to Start! This Repository includes the code and MORE exercises on each section of the entire cours

Jim Erg 64 Dec 23, 2022
Stori QA Automation Challenge

Stori-QA-Automation-Challenge This is the repository is created for the Stori QA Intern Automation Engineer Challenge! In this you can find the Requir

Daniel Castañeda 0 Feb 20, 2022