A collection of utilities related to patching Metal Libraries (.metallib) in macOS, specifically with the goal of restoring support for legacy hardware (namely Metal 3802-based GPUs on macOS Sequoia).
MetallibSupportPkg houses the metal_libraries python library, which was developed to streamline Metal Library patching through the following:
aastuff..metallib files..metallib files to support Metal 3802 GPUs.Notes regarding patching individual .metallib files:
.metallib file is actually a collection of .air files. Need to extract them using zhouwei's format.
.metallib files are actually FAT Mach-O files. Thus they need to be thinned manually (Apple's lipo utility does not support the AIR64 architecture we need).
.air files need to be next decompiled to .ll (LLVM IR) using Apple's metal-objdump utility.
.air, we use Apple's metal utility.
.air to a .metallib collection, we use Apple's metallib utility.
Once finished, the resulting .metallib files should work with Metal 3802-based GPUs in macOS Sequoia.
MetallibSupportPkg is not meant to be used by general users, the following is intended for developers.
Install the required dependencies:
python3 -m pip install -r requirements.txt
# Note Xcode is required to be installed for the `metal` and `metal-objdump` utilities
Fetch IPSW URL:
python3 metallib.py -d
# Example result: UniversalMac_15.0_24A5279h_Restore.ipsw
Extract system volume from IPSW:
python3 metallib.py -e <path_to_ipsw>
# Example result: 090-49684-056.dmg
Fetch Metal libraries from system volume, will extract to 15.x-<build>:
python3 metallib.py -f <path_to_system_volume>
# Example result: 15.0-24A5279h
Patch Metal libraries:
# Directory containing the Metal libraries
python3 metallib.py -p <path_to_metallib_dir>
# Individual Metal library
python3 metallib.py -p <path_to_metallib>
Convert Metal libraries to macOS package:
python3 metallib.py -z <path_to_metallib_dir>
# Example result: MetallibSupportPkg-15.0-24A5279h.pkg
usage: metallib.py [-h] [-d] [-e EXTRACT] [-f FETCH] [-p PATCH] [-b BUILD_SYS_PATCH] [-z BUILD_PKG] [-c]
Download, extract, fetch, and patch Metal libraries.
options:
-h, --help show this help message and exit
-d, --download Download the latest IPSW.
-e EXTRACT, --extract EXTRACT
Extract the system volume from an IPSW.
-f FETCH, --fetch FETCH
Fetch Metal libraries from the system volume.
-p PATCH, --patch PATCH
Patch Metal libraries.
-b BUILD_SYS_PATCH, --build-sys-patch BUILD_SYS_PATCH
Build a system patch dictionary.
-z BUILD_PKG, --build-pkg BUILD_PKG
Build a macOS package.
-c, --continuous-integration
Run in continuous integration mode.
82 followers · starred Mar 2025
1,290 followers · starred Sep 2024
A collection of utilities related to patching Metal Libraries (.metallib) in macOS, specifically with the goal of restoring support for legacy hardware (namely Metal 3802-based GPUs on macOS Sequoia).
MetallibSupportPkg houses the metal_libraries python library, which was developed to streamline Metal Library patching through the following:
aastuff..metallib files..metallib files to support Metal 3802 GPUs.Notes regarding patching individual .metallib files:
.metallib file is actually a collection of .air files. Need to extract them using zhouwei's format.
.metallib files are actually FAT Mach-O files. Thus they need to be thinned manually (Apple's lipo utility does not support the AIR64 architecture we need).
.air files need to be next decompiled to .ll (LLVM IR) using Apple's metal-objdump utility.
.air, we use Apple's metal utility.
.air to a .metallib collection, we use Apple's metallib utility.
Once finished, the resulting .metallib files should work with Metal 3802-based GPUs in macOS Sequoia.
MetallibSupportPkg is not meant to be used by general users, the following is intended for developers.
Install the required dependencies:
python3 -m pip install -r requirements.txt
# Note Xcode is required to be installed for the `metal` and `metal-objdump` utilities
Fetch IPSW URL:
python3 metallib.py -d
# Example result: UniversalMac_15.0_24A5279h_Restore.ipsw
Extract system volume from IPSW:
python3 metallib.py -e <path_to_ipsw>
# Example result: 090-49684-056.dmg
Fetch Metal libraries from system volume, will extract to 15.x-<build>:
python3 metallib.py -f <path_to_system_volume>
# Example result: 15.0-24A5279h
Patch Metal libraries:
# Directory containing the Metal libraries
python3 metallib.py -p <path_to_metallib_dir>
# Individual Metal library
python3 metallib.py -p <path_to_metallib>
Convert Metal libraries to macOS package:
python3 metallib.py -z <path_to_metallib_dir>
# Example result: MetallibSupportPkg-15.0-24A5279h.pkg
usage: metallib.py [-h] [-d] [-e EXTRACT] [-f FETCH] [-p PATCH] [-b BUILD_SYS_PATCH] [-z BUILD_PKG] [-c]
Download, extract, fetch, and patch Metal libraries.
options:
-h, --help show this help message and exit
-d, --download Download the latest IPSW.
-e EXTRACT, --extract EXTRACT
Extract the system volume from an IPSW.
-f FETCH, --fetch FETCH
Fetch Metal libraries from the system volume.
-p PATCH, --patch PATCH
Patch Metal libraries.
-b BUILD_SYS_PATCH, --build-sys-patch BUILD_SYS_PATCH
Build a system patch dictionary.
-z BUILD_PKG, --build-pkg BUILD_PKG
Build a macOS package.
-c, --continuous-integration
Run in continuous integration mode.
82 followers · starred Mar 2025
1,290 followers · starred Sep 2024