Skip to content

Commit 0b3e586

Browse files
authored
Merge pull request #880 from akshaynexus/master
Add Apple ID/iCloud troubleshooting for macOS Container
2 parents e962dce + fa7baa5 commit 0b3e586

File tree

2 files changed

+271
-0
lines changed

2 files changed

+271
-0
lines changed

FAQ.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,185 @@ If you wind up in the installer again after you've installed macOS it means you
160160

161161
Congratulations, you got a macOS VM up and running! Now what?
162162

163+
# Fixing Apple ID Login Issues in macOS Virtual Machines
164+
165+
## Problem Overview
166+
167+
When running macOS in a virtual machine, you may encounter problems logging into Apple services including:
168+
- Apple ID
169+
- iMessage
170+
- iCloud
171+
- App Store
172+
173+
This happens because Apple's services can detect that macOS is running in a virtual environment and block access. The solution is to apply a kernel patch that hides the VM presence from Apple's detection mechanism.
174+
175+
NOTE as per forum post: Unfortunately, this would very possibly break qemu-guest-agent, which is necessary for the host getting VM status or taking hot snapshot while the VM is running. This is because qemu-guest-agent also checks the hv_vmm_present flag, but only works if it is true (=1).
176+
177+
Use at your own risk. Hope it would help.
178+
179+
## Solution: Kernel Patching
180+
181+
This guide provides three methods to apply the necessary kernel patch. All methods implement the same fix originally described in [this forum post](https://forum.proxmox.com/threads/anyone-can-make-bluetooth-work-on-sonoma.153301/#post-697832).
182+
183+
### Prerequisites
184+
185+
Before proceeding with any method:
186+
- Make sure you can access your EFI partition
187+
- Locate your OpenCore `config.plist` file (typically in the `EFI/OC` folder)
188+
- Back up your current `config.plist` before making changes
189+
190+
## Method 1: Using the Utility Script (Simplest Approach)
191+
192+
This is the fastest and easiest way to apply the patch.
193+
194+
1. Mount your EFI partition using Clover Configurator or another EFI mounting tool
195+
2. Download the patch script:
196+
```bash
197+
curl -o apply_appleid_kernelpatch.py https://raw.githubusercontent.com/sickcodes/Docker-OSX/scripts/apply_appleid_kernelpatch.py
198+
```
199+
3. Run the script with your `config.plist` file path:
200+
```bash
201+
python3 apply_appleid_kernelpatch.py /path/to/config.plist
202+
```
203+
204+
**Pro Tip**: You can drag and drop the `config.plist` file into your terminal after typing `python3 apply_appleid_kernelpatch.py` for an easy path insertion.
205+
206+
**Note**: If you encounter a "permission denied" error, run the command with `sudo`:
207+
```bash
208+
sudo python3 apply_appleid_kernelpatch.py /path/to/config.plist
209+
```
210+
211+
## Method 2: Using OCAT (OpenCore Auxiliary Tools) GUI
212+
213+
If you prefer a graphical approach:
214+
215+
1. Open OCAT and load your `config.plist`
216+
2. Navigate to the **Kernel** section
217+
3. Go to the **Patch** subsection
218+
4. Add two new patch entries with the following details:
219+
220+
### Patch 1
221+
| Setting | Value |
222+
|---------|-------|
223+
| **Identifier** | `kernel` |
224+
| **Base** | *(leave empty)* |
225+
| **Count** | `1` |
226+
| **Find (Hex)** | `68696265726E61746568696472656164790068696265726E617465636F756E7400` |
227+
| **Limit** | `0` |
228+
| **Mask** | *(leave empty)* |
229+
| **Replace (Hex)** | `68696265726E61746568696472656164790068765F766D6D5F70726573656E7400` |
230+
| **Skip** | `0` |
231+
| **Arch** | `x86_64` |
232+
| **MinKernel** | `20.4.0` |
233+
| **MaxKernel** | *(leave empty)* |
234+
| **Enabled** | `True` |
235+
| **Comment** | `Sonoma VM BT Enabler - PART 1 of 2 - Patch kern.hv_vmm_present=0` |
236+
237+
### Patch 2
238+
| Setting | Value |
239+
|---------|-------|
240+
| **Identifier** | `kernel` |
241+
| **Base** | *(leave empty)* |
242+
| **Count** | `1` |
243+
| **Find (Hex)** | `626F6F742073657373696F6E20555549440068765F766D6D5F70726573656E7400` |
244+
| **Limit** | `0` |
245+
| **Mask** | *(leave empty)* |
246+
| **Replace (Hex)** | `626F6F742073657373696F6E20555549440068696265726E617465636F756E7400` |
247+
| **Skip** | `0` |
248+
| **Arch** | `x86_64` |
249+
| **MinKernel** | `22.0.0` |
250+
| **MaxKernel** | *(leave empty)* |
251+
| **Enabled** | `True` |
252+
| **Comment** | `Sonoma VM BT Enabler - PART 2 of 2 - Patch kern.hv_vmm_present=0` |
253+
254+
5. Save the configuration
255+
6. Reboot your VM
256+
257+
## Method 3: Direct `config.plist` Editing
258+
259+
For users who prefer to manually edit the configuration file:
260+
261+
1. Mount your EFI partition
262+
2. Locate and open your `config.plist` file in a text editor
263+
3. Find the `<key>Kernel</key>``<dict>``<key>Patch</key>``<array>` section
264+
4. Add these two `<dict>` entries within the `<array>`:
265+
266+
```xml
267+
<dict>
268+
<key>Arch</key>
269+
<string>x86_64</string>
270+
<key>Base</key>
271+
<string></string>
272+
<key>Comment</key>
273+
<string>Sonoma VM BT Enabler - PART 1 of 2 - Patch kern.hv_vmm_present=0</string>
274+
<key>Count</key>
275+
<integer>1</integer>
276+
<key>Enabled</key>
277+
<true/>
278+
<key>Find</key>
279+
<data>aGliZXJuYXRlaGlkcmVhZHkAaGliZXJuYXRlY291bnQA</data>
280+
<key>Identifier</key>
281+
<string>kernel</string>
282+
<key>Limit</key>
283+
<integer>0</integer>
284+
<key>Mask</key>
285+
<data></data>
286+
<key>MaxKernel</key>
287+
<string></string>
288+
<key>MinKernel</key>
289+
<string>20.4.0</string>
290+
<key>Replace</key>
291+
<data>aGliZXJuYXRlaGlkcmVhZHkAaHZfdm1tX3ByZXNlbnQA</data>
292+
<key>ReplaceMask</key>
293+
<data></data>
294+
<key>Skip</key>
295+
<integer>0</integer>
296+
</dict>
297+
<dict>
298+
<key>Arch</key>
299+
<string>x86_64</string>
300+
<key>Base</key>
301+
<string></string>
302+
<key>Comment</key>
303+
<string>Sonoma VM BT Enabler - PART 2 of 2 - Patch kern.hv_vmm_present=0</string>
304+
<key>Count</key>
305+
<integer>1</integer>
306+
<key>Enabled</key>
307+
<true/>
308+
<key>Find</key>
309+
<data>Ym9vdCBzZXNzaW9uIFVVSUQAaHZfdm1tX3ByZXNlbnQA</data>
310+
<key>Identifier</key>
311+
<string>kernel</string>
312+
<key>Limit</key>
313+
<integer>0</integer>
314+
<key>Mask</key>
315+
<data></data>
316+
<key>MaxKernel</key>
317+
<string></string>
318+
<key>MinKernel</key>
319+
<string>22.0.0</string>
320+
<key>Replace</key>
321+
<data>Ym9vdCBzZXNzaW9uIFVVSUQAaGliZXJuYXRlY291bnQA</data>
322+
<key>ReplaceMask</key>
323+
<data></data>
324+
<key>Skip</key>
325+
<integer>0</integer>
326+
</dict>
327+
```
328+
329+
5. Save the file
330+
6. Reboot your VM
331+
332+
## Important Notes
333+
334+
- The `MinKernel` values (`20.4.0` and `22.0.0`) may need adjustment depending on your specific macOS version (Monterey, Ventura, Sonoma, etc.)
335+
- If you encounter issues, consult the [OpenCore documentation](https://dortania.github.io/docs/) for appropriate values for your setup
336+
- Always back up your configuration before making changes
337+
- After applying the patch and rebooting, try signing into Apple services again
338+
339+
## What This Patch Does
340+
341+
This patch tricks macOS into believing it's running on physical hardware by redirecting the `hv_vmm_present` kernel variable, which normally indicates VM presence. After applying the patch, Apple services should function normally within your virtual environment.
163342
### Slow UI
164343

165344
The macOS UI expects and relies on GPU acceleration, and there is (currently) no way to provide GPU acceleration in the virtual hardware. See [osx-optimizer](https://github.com/sickcodes/osx-optimizer) for macOS configuration to speed things up.

scripts/apply_appleid_kernelpatch.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env python3
2+
import plistlib
3+
import base64
4+
import os
5+
import sys
6+
7+
def add_kernel_patches(config_path):
8+
# Make a backup of the original file
9+
backup_path = config_path + '.backup'
10+
os.system(f'cp "{config_path}" "{backup_path}"')
11+
print(f"Backup created at {backup_path}")
12+
13+
# Read the plist file
14+
with open(config_path, 'rb') as f:
15+
config = plistlib.load(f)
16+
17+
# Prepare the patch entries
18+
patch1 = {
19+
'Arch': 'x86_64',
20+
'Base': '',
21+
'Comment': 'Sonoma VM BT Enabler - PART 1 of 2 - Patch kern.hv_vmm_present=0',
22+
'Count': 1,
23+
'Enabled': True,
24+
'Find': base64.b64decode('aGliZXJuYXRlaGlkcmVhZHkAaGliZXJuYXRlY291bnQA'),
25+
'Identifier': 'kernel',
26+
'Limit': 0,
27+
'Mask': b'',
28+
'MaxKernel': '',
29+
'MinKernel': '20.4.0',
30+
'Replace': base64.b64decode('aGliZXJuYXRlaGlkcmVhZHkAaHZfdm1tX3ByZXNlbnQA'),
31+
'ReplaceMask': b'',
32+
'Skip': 0,
33+
}
34+
35+
patch2 = {
36+
'Arch': 'x86_64',
37+
'Base': '',
38+
'Comment': 'Sonoma VM BT Enabler - PART 2 of 2 - Patch kern.hv_vmm_present=0',
39+
'Count': 1,
40+
'Enabled': True,
41+
'Find': base64.b64decode('Ym9vdCBzZXNzaW9uIFVVSUQAaHZfdm1tX3ByZXNlbnQA'),
42+
'Identifier': 'kernel',
43+
'Limit': 0,
44+
'Mask': b'',
45+
'MaxKernel': '',
46+
'MinKernel': '22.0.0',
47+
'Replace': base64.b64decode('Ym9vdCBzZXNzaW9uIFVVSUQAaGliZXJuYXRlY291bnQA'),
48+
'ReplaceMask': b'',
49+
'Skip': 0,
50+
}
51+
52+
# Add patches to the kernel patch section
53+
if 'Kernel' in config and 'Patch' in config['Kernel']:
54+
# Check if patches already exist
55+
patch_exists = False
56+
for patch in config['Kernel']['Patch']:
57+
if isinstance(patch, dict) and 'Comment' in patch:
58+
if 'Sonoma VM BT Enabler' in patch['Comment']:
59+
patch_exists = True
60+
print(f"Patch already exists: {patch['Comment']}")
61+
62+
if not patch_exists:
63+
config['Kernel']['Patch'].append(patch1)
64+
config['Kernel']['Patch'].append(patch2)
65+
print("Added both Sonoma VM BT Enabler patches to config.plist")
66+
67+
else:
68+
print("Error: Could not find Kernel -> Patch section in config.plist")
69+
return False
70+
71+
# Write the updated plist file
72+
with open(config_path, 'wb') as f:
73+
plistlib.dump(config, f)
74+
75+
print(f"Successfully updated {config_path}")
76+
return True
77+
78+
if __name__ == "__main__":
79+
if len(sys.argv) != 2:
80+
print("Usage: python apply_appleid_kernelpatch.py /path/to/config.plist")
81+
sys.exit(1)
82+
83+
config_path = sys.argv[1]
84+
if not os.path.exists(config_path):
85+
print(f"Error: File {config_path} does not exist")
86+
sys.exit(1)
87+
88+
success = add_kernel_patches(config_path)
89+
if success:
90+
print("Patches applied successfully. Please reboot to apply changes.")
91+
else:
92+
print("Failed to apply patches.")

0 commit comments

Comments
 (0)