Skip to content

Instantly share code, notes, and snippets.

@superzazu
Created May 5, 2021 12:34
Show Gist options
  • Save superzazu/26cfa786f461827dd50d32e1080bdc5f to your computer and use it in GitHub Desktop.
Save superzazu/26cfa786f461827dd50d32e1080bdc5f to your computer and use it in GitHub Desktop.
makes a self-contained .app bundle for Ghidra 9.2.3 on macOS 11+ (ARM)
#!/bin/zsh
# ghidra_mac: makes a self-contained .app bundle for Ghidra 9.2.3 on macOS 11+ (ARM)
curl https://ghidra-sre.org/ghidra_9.2.3_PUBLIC_20210325.zip -o ghidra.zip
# https://www.azul.com/downloads/zulu-community/?version=java-11-lts&os=macos&package=jdk
curl https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_aarch64.tar.gz -o jdk.tar.gz
mkdir Ghidra.app
mkdir -p Ghidra.app/Contents/MacOS
mkdir -p Ghidra.app/Contents/Resources
unzip ghidra.zip
tar xvzf jdk.tar.gz
mv zulu11.48.21-ca-jdk11.0.11-macosx_aarch64/zulu-11.jdk Ghidra.app/Contents/Resources/
mv ghidra_9.2.3_PUBLIC Ghidra.app/Contents/Resources/
rm -r ./zulu11.48.21-ca-jdk11.0.11-macosx_aarch64
echo '#!/bin/zsh
dir=$(dirname "$0")
res="$dir/../Resources"
export PATH="$res/zulu-11.jdk/Contents/Home/bin:$PATH"
$res/ghidra_9.2.3_PUBLIC/ghidraRun
' > Ghidra.app/Contents/MacOS/ghidra
chmod +x Ghidra.app/Contents/MacOS/ghidra
echo '
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>ghidra</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>applet.icns</string>
<key>CFBundleIdentifier</key>
<string>org.ghidra-sre.ghidra</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>ghidra</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>
' > Ghidra.app/Contents/Info.plist
cp ./applet.icns Ghidra.app/Contents/Resources
rm ghidra.zip
rm jdk.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment