Repository navigation
Decompiling an arm64 macOS binary on x86_64 Linux with REA + Ghidra (no-sudo Ubuntu setup) #5626
mhamzasakhi
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I set up REA on Ubuntu 24.04 (x86_64) with Ghidra as the native engine, entirely in my home directory without
sudo. Here is what worked, what tripped me up, and one result I found interesting: decompiling a real arm64 macOS binary on an x86_64 Linux machine.Setup (no sudo)
Node.js. My system Node was 20, which REA does not support (it needs 22.19+, 24.11+ or 26+). I used nvm:
Ghidra 12.1.4 and JDK 21. I extracted both under
~/.local/tools, after checking their published SHA-256 sums:The Linux process checks also need a procps-compatible
ps. Ubuntu already includes it (procps-ng 4.0.4).Optional launcher. I added a tiny launcher at
~/.local/bin/rea. It sets those two variables and runs REA with Node 24, so my default Node can stay on 20 for other projects:Gotcha when building from a source checkout. After
npm ci, Turborepo's Linux binary was missing ("We did not find any binaries on this system"). Installing the locked platform package without saving fixed it:First results
rea decompile /usr/bin/true entry --provider ghidrareturned the__libc_start_mainentry stub in about 10 s.rea analyze-javascript-application <dir> --jsonworked with no native engine at all.Decompiling an arm64 macOS binary on x86_64 Linux
I cross-compiled the repository's C fixture with
zig ccinto a real arm64 Mach-O, then wrapped it in a one-slice universal (FAT) container:Results:
mainwithtarget_unavailable: FAT binary has no host-compatible x64 architecture. This is [Bug] list-architectures rejects universal Mach-O files without a host-compatible slice #5404.rea decompile <universal> _main --provider ghidrareturns real pseudo-code from the arm64 slice:So static analysis of foreign-architecture Apple binaries works fine from a Linux box, once the container admission no longer requires a host slice.
Contributions from this
UINavigationControllerand similar classes were reported as controls ([Bug] UIKit view-controller subclasses decode as controls #5218).Happy to answer questions about the Linux setup.
All reactions