# dortania/opencore-legacy-patcher architecture

> Architecture diagram of the GitHub repository dortania/opencore-legacy-patcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dortania/opencore-legacy-patcher
- Repository: https://github.com/dortania/opencore-legacy-patcher

## Overview

OpenCore Legacy Patcher helps users run newer macOS versions on unsupported Macs. The main workflow is to identify the Mac’s hardware, build an OpenCore configuration, and use it to boot macOS; users can also download or prepare installers and apply post-install root patches. The repository separates hardware detection, EFI configuration, installer/catalog handling, and system patching. The graph reflects the README’s major capabilities and the available source excerpts; several GUI-to-backend connections are inferred from module roles rather than verified calls.

Main entry points: [`opencore_legacy_patcher/sys_patch/sys_patch.py`](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/sys_patch.py) (Root patch coordinator), [`opencore_legacy_patcher/wx_gui/gui_main_menu.py`](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_main_menu.py) (Main menu), [`opencore_legacy_patcher/wx_gui/gui_sys_patch_start.py`](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_sys_patch_start.py) (Patch screens), [`opencore_legacy_patcher/detections/device_probe.py`](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/detections/device_probe.py) (Hardware probe)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gui["Patcher GUI<br/>[gui_entry.py]"]
  node_menu["Main menu<br/>[gui_main_menu.py]"]
  node_build_ui["Build screen<br/>[gui_build.py]"]
  node_install_ui["Installer screens"]
  node_patch_ui["Patch screens"]
end

subgraph group_configuration["Hardware and EFI"]
  node_hardware["Hardware probe<br/>[device_probe.py]"]
  node_os_probe["macOS detection<br/>[os_probe.py]"]
  node_datasets["Hardware datasets<br/>[model_array.py]"]
  node_efi["EFI build<br/>[build.py]"]
  node_efi_parts["Platform builders"]
end

subgraph group_install["Installers and updates"]
  node_installer_catalog["Update catalog<br/>[products.py]"]
  node_network["Network downloads<br/>[network_handler.py]"]
  node_installer_handler["Installer handling"]
  node_flash_ui["Installer creation"]
end

subgraph group_patching["System patching"]
  node_patch_detect["Patch detection<br/>[detect.py]"]
  node_patchsets["Hardware patchsets"]
  node_sys_patch["Root patch coordinator<br/>[sys_patch.py]"]
  node_mount["Volume mounting<br/>[mount.py]"]
  node_kernelcache["Kernel cache rebuild<br/>[rebuild.py]"]
  node_kdk["Kernel debug kits<br/>[kdk_handler.py]"]
  node_metallib["Metal libraries"]
end

node_user(("Mac user"))
node_apple_updates{{"Apple update services"}}

node_user -->|"uses"| node_gui
node_gui -->|"opens"| node_menu
node_menu -->|"selects build"| node_build_ui
node_menu -->|"selects installer"| node_install_ui
node_menu -->|"selects patching"| node_patch_ui
node_build_ui -->|"probes hardware"| node_hardware
node_hardware -->|"consults"| node_datasets
node_build_ui -->|"requests build"| node_efi
node_efi -->|"uses detected model"| node_hardware
node_efi -->|"dispatches builders"| node_efi_parts
node_install_ui -->|"lists installers"| node_installer_catalog
node_installer_catalog -->|"fetches catalog data"| node_network
node_network -.->|"requests data"| node_apple_updates
node_install_ui -->|"uses installer handling"| node_installer_handler
node_flash_ui -->|"prepares installer"| node_installer_handler
node_patch_ui -->|"checks macOS"| node_os_probe
node_patch_ui -->|"uses detected hardware"| node_hardware
node_patch_ui -->|"starts root patching"| node_sys_patch
node_sys_patch -->|"determines patches"| node_patch_detect
node_patch_detect -->|"selects patch definitions"| node_patchsets
node_sys_patch -->|"mounts system volume"| node_mount
node_sys_patch -->|"rebuilds caches"| node_kernelcache
node_sys_patch -->|"checks KDK"| node_kdk
node_sys_patch -->|"checks Metal libraries"| node_metallib

click node_gui "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_entry.py"
click node_menu "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_main_menu.py"
click node_build_ui "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_build.py"
click node_install_ui "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_macos_installer_download.py"
click node_patch_ui "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_sys_patch_start.py"
click node_hardware "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/detections/device_probe.py"
click node_os_probe "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/detections/os_probe.py"
click node_datasets "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/datasets/model_array.py"
click node_efi "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/efi_builder/build.py"
click node_efi_parts "https://github.com/dortania/opencore-legacy-patcher/tree/main/opencore_legacy_patcher/efi_builder"
click node_installer_catalog "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sucatalog/products.py"
click node_network "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/network_handler.py"
click node_installer_handler "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/macos_installer_handler.py"
click node_flash_ui "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_macos_installer_flash.py"
click node_patch_detect "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/patchsets/detect.py"
click node_patchsets "https://github.com/dortania/opencore-legacy-patcher/tree/main/opencore_legacy_patcher/sys_patch/patchsets/hardware"
click node_sys_patch "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/sys_patch.py"
click node_mount "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/mount/mount.py"
click node_kernelcache "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/kernelcache/rebuild.py"
click node_kdk "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/kdk_handler.py"
click node_metallib "https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/metallib_handler.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui,node_menu,node_build_ui,node_install_ui,node_patch_ui,node_user toneBlue
class node_hardware,node_os_probe,node_datasets,node_efi,node_efi_parts toneAmber
class node_installer_catalog,node_network,node_installer_handler,node_flash_ui toneMint
class node_patch_detect,node_patchsets,node_sys_patch,node_mount,node_kernelcache,node_kdk,node_metallib toneRose
class node_apple_updates toneIndigo
```

## Components

### User interface

- [Patcher GUI](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_entry.py): `opencore_legacy_patcher/wx_gui/gui_entry.py`
- [Main menu](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_main_menu.py): `opencore_legacy_patcher/wx_gui/gui_main_menu.py`
- [Build screen](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_build.py): `opencore_legacy_patcher/wx_gui/gui_build.py`
- [Installer screens](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_macos_installer_download.py): `opencore_legacy_patcher/wx_gui/gui_macos_installer_download.py`
- [Patch screens](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_sys_patch_start.py): `opencore_legacy_patcher/wx_gui/gui_sys_patch_start.py`

### Hardware and EFI

- [Hardware probe](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/detections/device_probe.py): `opencore_legacy_patcher/detections/device_probe.py`
- [macOS detection](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/detections/os_probe.py): `opencore_legacy_patcher/detections/os_probe.py`
- [Hardware datasets](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/datasets/model_array.py): `opencore_legacy_patcher/datasets/model_array.py`
- [EFI build](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/efi_builder/build.py): `opencore_legacy_patcher/efi_builder/build.py`
- [Platform builders](https://github.com/dortania/opencore-legacy-patcher/tree/main/opencore_legacy_patcher/efi_builder): `opencore_legacy_patcher/efi_builder`

### Installers and updates

- [Update catalog](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sucatalog/products.py): `opencore_legacy_patcher/sucatalog/products.py`
- [Network downloads](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/network_handler.py): `opencore_legacy_patcher/support/network_handler.py`
- [Installer handling](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/macos_installer_handler.py): `opencore_legacy_patcher/support/macos_installer_handler.py`
- [Installer creation](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/wx_gui/gui_macos_installer_flash.py): `opencore_legacy_patcher/wx_gui/gui_macos_installer_flash.py`

### System patching

- [Patch detection](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/patchsets/detect.py): `opencore_legacy_patcher/sys_patch/patchsets/detect.py`
- [Hardware patchsets](https://github.com/dortania/opencore-legacy-patcher/tree/main/opencore_legacy_patcher/sys_patch/patchsets/hardware): `opencore_legacy_patcher/sys_patch/patchsets/hardware`
- [Root patch coordinator](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/sys_patch.py): `opencore_legacy_patcher/sys_patch/sys_patch.py`
- [Volume mounting](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/mount/mount.py): `opencore_legacy_patcher/sys_patch/mount/mount.py`
- [Kernel cache rebuild](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/sys_patch/kernelcache/rebuild.py): `opencore_legacy_patcher/sys_patch/kernelcache/rebuild.py`
- [Kernel debug kits](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/kdk_handler.py): `opencore_legacy_patcher/support/kdk_handler.py`
- [Metal libraries](https://github.com/dortania/opencore-legacy-patcher/blob/main/opencore_legacy_patcher/support/metallib_handler.py): `opencore_legacy_patcher/support/metallib_handler.py`

### Other components

- **Mac user**
- **Apple update services**

## Connections

- Mac user → Patcher GUI: uses
- Patcher GUI → Main menu: opens
- Main menu → Build screen: selects build
- Main menu → Installer screens: selects installer
- Main menu → Patch screens: selects patching
- Build screen → Hardware probe: probes hardware
- Hardware probe → Hardware datasets: consults
- Build screen → EFI build: requests build
- EFI build → Hardware probe: uses detected model
- EFI build → Platform builders: dispatches builders
- Installer screens → Update catalog: lists installers
- Update catalog → Network downloads: fetches catalog data
- Network downloads → Apple update services: requests data
- Installer screens → Installer handling: uses installer handling
- Installer creation → Installer handling: prepares installer
- Patch screens → macOS detection: checks macOS
- Patch screens → Hardware probe: uses detected hardware
- Patch screens → Root patch coordinator: starts root patching
- Root patch coordinator → Patch detection: determines patches
- Patch detection → Hardware patchsets: selects patch definitions
- Root patch coordinator → Volume mounting: mounts system volume
- Root patch coordinator → Kernel cache rebuild: rebuilds caches
- Root patch coordinator → Kernel debug kits: checks KDK
- Root patch coordinator → Metal libraries: checks Metal libraries
