Skip to content
gfyrguPublic

About

Independent macOS binary compatibility layer for x86_64 Linux

Resources

Stars

48 stars

Watchers

1 watching

Forks

Repository files navigation

Mine

MINE banner with a moonlit penguin on the left and a silver MINE wordmark on the right

An independent, source-built macOS binary compatibility layer for x86_64 Linux. Mine targets shared Darwin/macOS ABIs and framework behavior across applications. VLC and Jianying are compatibility test inputs; their progress does not define or imply complete platform support. Framework fixes belong in the shared implementation and need application-independent behavior tests. Original application binaries remain unchanged. Current API coverage and limitations are recorded in docs/status.md and the framework-specific records.

Source preview

The first public release, v0.1.0-alpha.1, covers development and compatibility testing on x86_64 Linux. The release handoff explains supported paths, build requirements, validation results and remaining compatibility gaps. 中文交接报告

Architecture

Mine loads macOS Mach-O applications on x86_64 Linux. It executes x86_64 code directly and runs ARM64 code through its interpreter and JIT. Guest libraries and Darwin ABI adapters connect both paths to Linux services.

Runtime architecture and ABI boundaries · Editable SVG

Demonstrations

Jianying 11.8 · 剪映

The original Jianying editor running through Mine on Linux, with synthetic footage on its timeline. The captures show a resized preview at 2× scale, a clip split at the playhead, and the 1080p H.264 MP4 export settings.

Editor at 2× · 编辑器 Timeline split · 时间线分割 MP4 settings · 导出参数
Jianying editor and timeline Two clips after a timeline split Jianying 1080p MP4 export settings

x86_64 VLC · Intel 版

The original macOS x86_64 build of VLC 3.0.24 playing a synthetic H.264 test clip through Mine on x86_64 Linux. This capture uses a KWin session at 2× scale and Intel VAAPI hardware decoding.

Early playback · 0.750 s Mid-playback · 4.125 s
x86_64 VLC playing the test clip at 0.750 seconds x86_64 VLC playing the test clip at 4.125 seconds

ARM64 VLC

The original ARM64 VLC 3.0.24 player running through Mine, with Intel VAAPI hardware H.264 decoding. These frames come from an eight-second KWin recording of a synthetic test clip. The recording has no audio track.

Start · 开始 Middle · 中段 End · 结束
VLC playback at the start VLC playback in the middle VLC playback near the end

Download the VLC playback recording · 下载实机录屏

Acknowledgments

Thank you to the engineers at Apple and to the Apple Open Source contributors for making Darwin, XNU, dyld, objc4 and their documentation available. Their work provided references and licensed components for this independent compatibility project. Thanks also to the Swift, LLVM, FFmpeg, KDE, Wayland and VideoLAN contributors.

macOS and Final Cut Pro are trademarks of Apple Inc. Mine is an independent project. Third-party notices

Implementation

The current implementation builds on the M0/M1 loader foundation in PLAN.md. It executes real x86_64 Mach-O code, resolves source-built compatibility dylibs, and supplies a Darwin ABI bridge with M2 thread lifecycle/synchronization and source-built LLVM stack unwinding, guest C++ exceptions/RTTI and libc++. Darwin file, locale, UTF-8 and stdio adapters support the standard-library probes. Tracked heap allocation and malloc zones provide ownership and custom callbacks needed by the objc4 port; their tested scope is in docs/allocation.md. Process-local Mach thread references, real register sampling, executable/shared VM remapping and protection are described in docs/mach-services.md. Loader metadata, LOCAL/FIRST lookup and the tested ObjC bootstrap/notification contract are described in docs/dyld-objc.md. Source-built Apple objc4 now runs class/category/message, ARC/weak, synchronization and exception probes; its recipe and remaining boundaries are in docs/objc4-port.md. Mine's guest Foundation and AppKit frameworks provide fast forwarding, collection and text services, KVC/KVO, file and bundle access, keyed decoding, and a tested set of AppKit views, controls, controllers and nib connections. Their source lives in src/frameworks/. The desktop backend uses Linux Wayland, xdg-shell, xkbcommon and Fontconfig. Install their development packages and wayland-protocols (including staging ext-data-control-v1) and wayland-scanner for the build, plus libwayland-server and a system font for integration tests. FreeType and HarfBuzz are statically built from the locked source archives for drawing. The HTML renderer requires the WebKitGTK 4.1 and GTK 3 development packages. CoreAudio device properties use libpulse. File coordination uses libarchive for directory upload snapshots. Building the XAR and XML backends requires GNU Make and development packages for libxml2 >= 2.13, OpenSSL libcrypto, liblzma, zlib, libbz2 and libacl. The CGL/OpenGL backend requires EGL 1.5 development headers and a host desktop OpenGL driver with EGL's surfaceless platform (tested with NVIDIA and Mesa llvmpipe). Legacy GLU tessellation uses the host libGLU.so.1. Its current API and presentation limits are recorded in docs/graphics-references.md. NSOpenGLView video can present directly through a Wayland EGL child surface. Mine attempts its EGL/OpenGL AppKit renderer for geometry, images, glyphs and linear/radial gradients by default. Set MINE_GPU_UI=0 for CPU drawing; unavailable GPU contexts and unsupported drawing fall back to a complete CPU frame. The normal build also includes Mine's authored Metal/MetalKit subset and Vulkan backend. It requires LLVM 23 (llvm-config-23), the matching Clang C++ library and headers, SPIRV-Tools, the Vulkan loader, and libdrm development headers. Pinned source references, retained licenses and rebuild commands are in experimental/metal/third_party/. The tested packed-image path shares GPU storage with EGL and supports explicit CPU drawing fallback; NV12 video can share same-device Vulkan Video images or imported VAAPI dma-buf planes. Original editor GPU execution remains incomplete.

ScreenCaptureKit provides SCStream and the filter-based SCScreenshotManager methods that return a CGImage or a timed CMSampleBuffer. Application-window capture is scoped to windows owned by the guest process. Display capture uses PipeWire and the desktop portal's source selection and permission flow. The private Wayland integration test checks one-shot image and sample pixels and stream delivery on both guest architectures at 2× scale.

BackgroundAssets schedules unattended HTTPS transfers while a Mine guest is running. BADownloadManager saves its queue, completed files and validated partial transfers under the app's state directory. Pending assets can resume when the app relaunches, including when it switches guest architectures. Apple-managed asset packs, app-extension activation and the off-process download service remain open.

CoreAudio uses libpulse to connect to PulseAudio or a PipeWire Pulse server. It uses the normal server selection; PULSE_SERVER and PULSE_SINK can select an endpoint and output device. An isolated Wayland session that changes XDG_RUNTIME_DIR must retain access to its audio server, for example by setting PULSE_SERVER to the existing server's Unix socket. System device listeners can register while the server is offline and notify the guest when real device data becomes available or the server restarts. This does not implement seamless recovery of an already running AudioUnit stream. AudioUnit Stop wakes a blocked Pulse write before joining its render thread; the stream closes after that join.

Foundation's DNS-SD browsers, resolver, service publisher and TXT monitor use the host Avahi client/common shared libraries. Building requires the avahi-client development package. Live operation also requires system D-Bus and avahi-daemon. A publisher can register an existing port or open a TCP listener, update its TXT record and withdraw the registration. Receivers can enumerate browse and registration domains and subscribe to TXT changes while independently resolving a service. See third_party/recipes/avahi-system.json for source and licensing.

NSWorkspace's Linux services also use GIO and GTK 3/GdkPixbuf for desktop URI handlers, file-manager D-Bus calls, reversible trash and host icon rasterization. Adwaita/hicolor icon assets are read from the host distribution. The desktop status-item helper requires KDE Frameworks 6 KStatusNotifierItem >= 6.14 and Qt 6 Widgets development packages. It dynamically links the host libraries; their licensing and source locations are recorded in THIRD_PARTY_NOTICES.md. The HTTP transport builds curl and Mbed TLS from their source locks. The private loopback TLS probe requires the Linux openssl tool to generate a test CA. Security.framework uses libsecret for persistent generic and internet passwords in a Mine-owned Secret Service collection. A profile without a usable Secret Service can fall back to authenticated AES-GCM storage with user-private files. Setting kSecUseDataProtectionKeychain selects a second collection or local store, scoped within Mine by the resolved executable path. Moving the executable changes that scope. Apple keychain access-group entitlements, iCloud synchronization and Secure Enclave storage are unsupported. Source-built Swift Blocks, Mine's NSBlock classes and Apple x86_64 Block trampolines pass C/C++ and ObjC capture/weak ownership probes, concurrent destruction and actual Block-to-IMP allocation/removal/reuse; see docs/blocks-runtime.md for the measured scope and limits. CRT/environment, process identities, positioning reads, clocks and thread-name behavior are covered in docs/process-runtime.md. Guest backtraces, image-local crash annotations and Linux diagnostic transport are described in docs/diagnostics.md. Source-built libdispatch now supplies queues, groups, Blocks, timers, data and asynchronous I/O with real OS_dispatch ObjC ownership, weak references, work-item autorelease pools and client exception handling. Signal/semaphore adapters and remaining limits are in docs/dispatch.md. Source-built Apple ICU supplies Unicode, locale, calendar and regex behavior, with embedded data built by native source tools. A source-built OpenLibm binary64 subset and time-zone adapters support it; see docs/icu-runtime.md. Account lookup, Mach clocks, section descriptors, locale output and source-built C cleanup personality support the ongoing CoreFoundation port; see docs/corefoundation-prerequisites.md. The source-built CoreFoundation framework exposes a CFRunLoop subset on the same per-thread scheduler as NSRunLoop. See docs/cocoa-frameworks.md for its scope. The primary guest target is x86_64; the experimental ARM64 translator also runs the tested VLC GUI/video path at 2x backing scale with NVIDIA Vulkan Video and direct CGL presentation. Cocoa coverage is listed by API and probe in docs/cocoa-frameworks.md. The original Intel VLC GUI can play the tested H.264 sample with VideoToolbox/VAAPI or NVIDIA Vulkan Video, CGL GPU presentation and AUHAL audio. Complete application/framework coverage, Swift ABI coverage and ARM64 instruction support remain incomplete. The default process OS profile is macOS 15.6 and increases when the executable or bundle requires a newer release. --guest-target can select an explicit profile independently of the SDK's compilation minimum. The original VLC 3.0.24 bundle's measured progress and current blockers are in the VLC status record.

Build

Requirements: x86_64 Linux with 4 KiB pages and kernel >= 5.3, a C++20 compiler, CMake >= 3.24, Ninja, GNU make, Python >= 3.12, CPython 3.11 for SoundAnalysis's locked inference wheels, patch, and permission to trace your own children. Install the development packages for Kerberos GSSAPI, libsecret, PipeWire, JSON-GLib, BlueZ, ALSA, libseccomp, p11-kit and Enchant alongside the desktop and graphics packages listed above. The tray target also needs KDE Frameworks 6 WindowSystem and Qt 6 DBus. 7z reads UDIF partitions for disk-image attachment and unpacks the official VLC acceptance input. HFS+ attachment also uses UDisks2, and APFS uses FUSE 3. The first tool build uses network access; runtime and subsequent builds work offline. The Linux video backend requires libva/libdrm development packages and a VAAPI driver for hardware decoding. EGL/desktop OpenGL and wayland-egl provide GPU presentation. The status-item integration test uses the distribution Python's dbus and PyGObject modules, plus dbus-run-session. The optional CoreAudio reconnect test uses pipewire, pipewire-pulse and pactl to run its own protocol-only server and null sink. It does not restart the user's audio service or change the default output device. The AudioUnit cancellation test also uses parec and pw-link to verify PCM and Stop while its own server is paused.

Speech.framework supports offline US English recognition from local audio files on both guest architectures. Install PocketSphinx 5 and its US English model to enable it. On Arch-based hosts with the archlinuxcn repository configured, pacman -Si pocketsphinx shows the package and sudo pacman -S pocketsphinx installs the engine and model. Mine looks for libpocketsphinx.so.5 through the host library search path and for the model under /usr/share/pocketsphinx/model/en-us or /usr/local/share/pocketsphinx/model/en-us. For a model installed elsewhere, set MINE_SPEECH_MODEL_DIR to the absolute directory containing en-us/, en-us.lm.bin, and cmudict-en-us.dict. The framework delivers one final transcription with timed word segments. Live microphone recognition, interim transcripts, and additional language models are outside the current implementation.

python3 tools/fetch_sources.py llvm --jobs 4
python3 tools/fetch_sources.py apple-libc
python3 tools/fetch_sources.py blocks
python3 tools/fetch_sources.py dispatch
python3 tools/fetch_sources.py objc-trampolines
python3 tools/fetch_sources.py objc4
python3 tools/fetch_sources.py xar
python3 tools/fetch_sources.py zlib
python3 tools/fetch_sources.py lzfse
python3 tools/fetch_sources.py apfs-fuse
python3 tools/fetch_sources.py bzip2
python3 tools/fetch_sources.py cups
python3 tools/fetch_sources.py quirc
python3 tools/fetch_sources.py openlibm
python3 tools/fetch_sources.py icu
python3 tools/fetch_sources.py text
python3 tools/fetch_sources.py network
python3 tools/fetch_sources.py lcms2
python3 tools/fetch_sources.py expat
python3 tools/fetch_sources.py libxml2
python3 tools/fetch_sources.py sqlite
python3 tools/fetch_sources.py graphics
python3 tools/fetch_sources.py ffmpeg-video
python3 tools/fetch_sources.py soundanalysis
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DMINE_GUEST_CLANG="$PWD/.cache/llvm-build/bin/clang" \
  -DMINE_GUEST_LD="$PWD/.cache/llvm-build/bin/ld64.lld" \
  -DMINE_GUEST_AR="$PWD/.cache/llvm-build/bin/llvm-ar"
cmake --build build -j 4
ctest --test-dir build --output-on-failure
build/bin/mine doctor
build/bin/mine run build/probes/hello argument

Application-side libraries and probes compile using Mine's sdk/include, the pinned Clang builtin headers and upstream LLVM runtime headers. They do not use a macOS sysroot or Linux C-library headers. The runtime builds libunwind, libc++abi, libc++, six compiler-rt integer helpers and the C cleanup personality from the same official LLVM archive. The Darwin error-message table is built from a separately pinned Apple open-source Libc release. The Blocks core comes from Swift's pinned libdispatch release. Its scheduler and event implementation are now built with a locked Mine platform patch; the trampoline assembly comes from Apple's objc4 release. Recipes and libc++ header configuration are in third_party/recipes/. See docs/cxx-runtime.md for tested behavior and limits. The same build also compiles the locked ICU native data tools, embeds their resource package in the guest ICU dylib, and builds the OpenLibm binary64 subset. The native ICU libraries are build tools and are not installed as guest runtime. The pinned official LLVM source and download SHA-256 are in third_party/sources.lock.json; build/build-manifest.json records commands, tool versions and output hashes. The toolchain includes llvm-ar for the SDK's libCrashReporterClient.a. A locked LLD patch corrects dependency ordinals after reexports; bin/mine-toolchain.json records source/patch identities and binary hashes. Rerun the LLVM fetch/build command when upgrading an older local build. Explicit alternative compiler/linker/archiver paths are accepted for development and recorded in the manifest; they are not pinned release evidence.

Commands

build/bin/mine inspect path/to/Mach-O
build/bin/mine inspect path/to/Application.app
build/bin/mine run path/to/Mach-O argument
build/bin/mine run --runtime path/to/runtime path/to/Application.app
cmake --install build --prefix "$PWD/build/install"

On a hybrid laptop with an Intel-driven display and an NVIDIA GPU, an editor can use Intel Metal rendering throughout a session. This avoids waiting for the discrete GPU to wake when returning to an edit. The vendor filter applies to the Metal devices visible to that process.

MINE_METAL_DEVICE_VENDOR=0x8086 build/bin/mine run path/to/Application.app

inspect emits JSON: selected/Fat architectures, commands, dependencies, imports, entry, deployment target and fixup formats. .app launch metadata may be XML or binary plist. run preserves the guest's output and exit status; diagnostics are JSON on stderr. Unsupported interfaces fail explicitly. The minimal read/write bridge translates Linux errno to Darwin; unknown direct Darwin syscalls are suppressed and return Darwin ENOSYS with carry set.

The executable discovers runtime/ beside its build bin/, or lib/mine/runtime/ under its install prefix. MINE_RUNTIME and --runtime can override that location. No workspace or home-directory path is compiled in.

Mine omits Linux Wayland and XCB entries from the guest's inherited QT_QPA_PLATFORM list so bundled Qt can choose its macOS platform. Set MINE_GUEST_QT_QPA_PLATFORM to supply an explicit guest platform list.

The supervisor is a semantic development tool, not a security sandbox. Guest programs run with the launching user's permissions. By default Mine probes SUD before executing the application and uses ptrace when the facility is unavailable. MINE_SYSCALL_BACKEND=ptrace or sud requires that backend. SUD removes external ptrace supervision but retains Native SIGSYS dispatch overhead; see syscall backends for the current limits.

VLC analysis

python3 tools/fetch_sources.py vlc
python3 tests/integration/vlc_startup.py --mine build/bin/mine '.cache/vlc/VLC media player/VLC.app'
python3 tools/analyze_app.py '.cache/vlc/VLC media player/VLC.app' \
  --mine build/bin/mine --output artifacts/vlc-3.0.24-inventory.json

The historical tools/verify_isolated.py harness records the earlier Cocoa desktop verification setup. Its source allowlist predates the Metal build. Use the CTest invocation in the build section for this preview.

See docs/status.md for evidence and limitations, docs/architecture.md for the bridge and filesystem contract, and docs/graphics-references.md for the two graphics projects supplied as references. docs/rosemary-reference.md records the implementation review and the user's prohibition on code reuse. See Rosemary 功能盘点 for upstream behaviour and Mine framework coverage for what runs here. Original code is MIT licensed; third-party notices and licenses stay separate.

About

Independent macOS binary compatibility layer for x86_64 Linux

Resources

Stars

48 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages