百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

macos-arm64-emulation

> 编程语言
开源

在基于 x86 的主机上模拟 macOS arm64e 的指南。

348 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

在基于 x86 的主机上模拟 macOS arm64e 的指南。

macos-arm64-emulation

Use the following guide to download and configure all of the necessary tools and files for emulating the macOS arm64e kernel. The guide begins in this project's root directory, ie. the same directory as this README file.

Install decompression tools

Get, patch, and build xar:

bash
git clone https://github.com/mackyle/xar.git
cd xar/xar
sed -i 's/OpenSSL_add_all_ciphers/OPENSSL_init_crypto/g' configure.ac
cat > ext2.patch  sfr.zip
7z e -so 5.hfs "Shared Support/com_apple_MobileAsset_MacSoftwareUpdate/6c799f422b6d995ccc7f3fb669fe3246fd9f61aa.zip" > mac.zip
rm 5.hfs
7z e sfr.zip AssetData/usr/standalone/update/ramdisk/arm64eSURamDisk.dmg
7z e sfr.zip AssetData/boot/Firmware/all_flash/DeviceTree.j273aap.im4p
7z e sfr.zip AssetData/boot/kernelcache.release.j273

Decode the kernel binaries:

…

Patching the Device Tree

Build dtetool and patch the device tree file:

bash
cd dtetool
./build.sh
./dtetool ../DeviceTree.j273aap.im4p.out -d dtediff_20C69 -o ../DeviceTree.j273aap.im4p.out.patched
cd ..

Expanding the ramdisk in macOS

This step can only be done on a macOS system. Copy the ramdisk onto a macOS system and expand it:

hdiutil resize -size 1.5G -imagekey diskimage-class=CRawDiskImage arm64eSURamDisk.dmg.out

Getting the user binaries

Copy the expanded ramdisk back onto the Linux system and extract the user binaries:

7z e mac.zip AssetData/Restore/022-10310-098.dmg
rm mac.zip
7z e 022-10310-098.dmg "3 - Apple_APFS"
rm 022-10310-098.dmg

Mount the filesystem and ramdisk to two new directories:

bash
mkdir apfs ramdisk
apfs-fuse -o allow_other "3 - Apple_APFS" apfs
sudo mount -t hfsplus -o force,rw arm64eSURamDisk.dmg.out ramdisk

Transfer the user binaries to ramdisk:

bash
sudo cp -rn apfs/root/bin/* ramdisk/bin/
sudo cp -rn apfs/root/sbin/* ramdisk/sbin/
sudo cp -rn apfs/root/usr/bin/* ramdisk/usr/bin/
sudo cp -rn apfs/root/usr/sbin/* ramdisk/usr/sbin/

Remove all existing launchd profiles and create a profile for bash:

bash
sudo rm -rf ramdisk/System/Library/LaunchDaemons/*
cat > com.apple.bash.plist 

        Label
        com.apple.bash
        Umask
        0
        RunAtLoad
        
        ProgramArguments
        
                /bin/bash
        
        StandardInPath
        /dev/console
        StandardOutPath
        /dev/console
        StandardErrorPath
        /dev/console
        POSIXSpawnType
        Interactive
        EnablePressuredExit
        
        UserName
        root

EOF 
sudo cp com.apple.bash.plist ramdisk/System/Library/LaunchDaemons/

Unmount the disk images:

bash
sudo umount apfs ramdisk

Building QEMU

Download, extract, and patch the QEMU 5.1.0 source:

bash
wget https://download.qemu.org/qemu-5.1.0.tar.xz
tar xf qemu-5.1.0.tar.xz
mv qemu-5.1.0 xnu-qemu-arm64-5.1.0
git apply xnu-qemu-arm64-5.1.0.diff

Configure and build the source:

bash
cd xnu-qemu-arm64-5.1.0
./configure --target-list=aarch64-softmmu --disable-capstone --disable-pie --disable-slirp
make -j6
cd ..

Modify the -j6 option according to the number of cores on your CPU times 1.5.

Start the emulator

Start the emulator with the following script:

bash
./xnu-qemu-arm64-5.1.0/aarch64-softmmu/qemu-system-aarch64 \
-M macos11-j273-a12z,\
kernel-filename=kernelcache.release.j273.out,\
dtb-filename=DeviceTree.j273aap.im4p.out.patched,\
ramdisk-filename=arm64eSURamDisk.dmg.out,\
kern-cmd-args="kextlog=0xfff cpus=1 rd=md0 serial=2 -noprogress",\
xnu-ramfb=off \
-cpu max \
-m 6G \
-serial mon:stdio \
-nographic \

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言