Skip to content

Run macOS VM in a Docker Container! This fork is for getting AirMessage/BlueBubbles up and running (somewhat) quickly ⚡️

Notifications You must be signed in to change notification settings

vandamd/Docker-OSX

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macOS in Docker for AirMessage/BlueBubbles

This is a quick guide to get macOS running in Docker on Ubuntu Desktop!

Credits

Full credits go to Sick.Codes, and all the other contributers that can be listed here and here.

kholia for maintaining OSX-KVM.

thenickdude for maintaining KVM-OpenCore, which was started by Leoyzen.

The OpenCore team (https://github.com/acidanthera/OpenCorePkg).

If you like this project, consider contributing here!

This guide is a combination of information gathered and modified from the BlueBubbles Wiki and Docker-OSX README.md. Full credits go to them 😊

Quick Start Docker-OSX

This guide uses a fresh install of Ubuntu Desktop 22.04 LTS (download), updated with

sudo apt update
sudo apt upgrade

Prerequisite Setup (source)

  1. Turn on hardware virtualisation in your BIOS
  2. Install QEMU and other dependancies with:
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools make gcc git screen
  1. Clone this repo for a copy of the bash scripts (or you can just copy and paste them into your terminal)
git clone https://github.com/vandamd/Docker-OSX.git
  1. Install Docker (source)
sudo apt-get update

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  1. Enable Docker usage as a non-root user (source)
sudo groupadd docker

sudo usermod -aG docker $USER
  1. Log out and log back in
newgrp docker
  1. (On a different machine,) download a VNC Viewer such as TigerVNC or VNC Viewer. This is used for remotely accessing macOS inside the Docker container

Initiating the base image (source)

  1. Run the first bash script to initiate the base image:
bash Docker-OSX/1_baseimage.sh
  1. Connect to macOS via VNC, your VNC Server address may look like 192.168.1.77:5999. Your IP Address is probably something else, can find it using hostname -I

Install macOS (source)

  1. Boot into macOS Base System (Press Enter)

  2. Click Disk Utility

  3. Erase the BIGGEST disk (around 200gb default), DO NOT MODIFY THE SMALLER DISKS. If you can't click erase, you may need to reduce the disk size by 1kb

  4. Click Reinstall macOS. The system may require multiple reboots during installation

  5. Setup macOS as normal. You can sign into iCloud during setup or do it later, it doesn't matter

  6. Once finished, DO NOT OPEN iMessage

  7. Shutdown macOS as normal

Extract image (source)

  1. Run the second bash script:
bash Docker-OSX/2_extractimage.sh

This script finds mac_hdd_ng.img from /var/lib/docker, then copies it to the home folder.

NOTE: This may take a while!

Generate Unique Serial (source)

  1. Run the third bash script:
bash Docker-OSX/3_genserial.sh

This generates credentials such as SMBIOS, Serial Number, UUID so that the VM looks like an actual Mac! These credentials are placed in the home folder.

You can verify if your serial number is suitable by entering into Apple's Check Coverage site. You should get the message 'Unable to check coverage for this serial number.' in red font. If not, run delete the file called my_permanent_serial_number.sh in your home folder and run the third bash script again.

First Run (source)

  1. Run the fourth bash script:
bash Docker-OSX/4_firstrun.sh
  1. Connect via VNC using the same address as before

  2. Login to macOS as usual, open iMessage and setup iCloud Sync

  3. Setup AirMessage/BlueBubbles!

Subsequent Runs (source)

  1. From now on you only need to run the fifth bash script to turn on the Docker container
bash Docker-OSX/5_subrun.sh

Notes

If you want macOS to turn on when you boot up Ubuntu, you can change the restart policy. You can find out here. I used Portainer to do it as I prefer managing other containers with it!

If it's a bit slow you can look at this to optimise macOS.

For those of you who are running on a Dell XPS like I am, consider limiting your battery charge with Dell's Command | Configure, and disabling suspension when closing the lid.

  • You can find Dell's Command | Configure here, search for your laptop model
  • sudo ./cctk --PrimaryBattChargeCfg=Custom:50-80
  • To disable suspension when lid is closed, install Gnome Tweak Tool, open it and disable suspension

About

Run macOS VM in a Docker Container! This fork is for getting AirMessage/BlueBubbles up and running (somewhat) quickly ⚡️

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%