Here, I'll show you how to compile Frida (≥ 16.2.2) for both rootfull and rootless jailbreaks.
If you want to compile an old version of Frida (< 16.2.2) you can use my old guide.
- Make sure you have:
- Python 3.7+ in your PATH. Required by Meson.
- Node.js in your PATH
macOS is required because you need to use Apple's proprietary software like Xcode, lipo
, and codesign
.
Warning
Before starting, read carefully up to the end.
- Install the latest version of Xcode with command-line tools from the App Store. Without it, you won't have iPhoneOS SDKs.
- Download Xcode 11.7 directly from Apple at the following link: Xcode_11.7.xip. You will need to authenticate with your Apple ID to download it. Then set the following env:
export XCODE11=/Applications/Xcode-11.7.app
Tip
To better manage multiple Xcode versions, you can use a CLI tool called xcodes
.
Alternatively, if you prefer an equivalent GUI app, you can use XcodesApp.
- Once downloaded, opening the .xip archive will begin extracting it. After extraction, rename the app to avoid conflicting with your primary installation of Xcode and move it to
/Applications/
(e.g.,mv Xcode.app /Applications/Xcode-11.7.app
). - Download this script, change
gdb_codesign
tofrida-cert
, and then run it. - Run
brew install dpkg
to installdpkg-deb
.
Note
To compile Frida I use gmake
. If you don't want to install it you can use make
shipped by Apple with Xcode Command Line Tools.
- Clone the project:
git clone https://github.com/frida/frida.git cd frida
-
(Optional) Check out the latest stable release:
To go back to
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1)")"
origin/main
, rungit switch -
. -
(Optional) Select your preferred Xcode version:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
- Export the identity previously created in an enviroment variable called
IOS_CERTID
:export IOS_CERTID=frida-cert
- To package everything you must set the following env:
gmake git-submodules FRIDA_VERSION=$(releng/frida_version.py) export FRIDA_VERSION
- Build
frida-server
andfrida-agent.dylib
for 3 different architectures:mkdir -vp release-assets for jb in rootless rootfull; do for arch in arm64 arm64e arm64eoabi; do MESON_BUILD_ROOT="$(pwd)/build-${arch}-${jb}" export MESON_BUILD_ROOT if [ "${jb}" = "rootless" ]; then ./configure --host=ios-"${arch}" --prefix=/var/jb else ./configure --host=ios-"${arch}" fi gmake -j$(($(/usr/sbin/sysctl -n hw.logicalcpu) + 1)) done frida_ios_universal_path="$(pwd)/ios-${jb}-assets/$(if [ "${jb}" = "rootless" ]; then echo "var/jb/"; fi)" mkdir -vp "${frida_ios_universal_path}"/usr/{bin,lib/frida}/ python ./releng/mkfatmacho.py "${frida_ios_universal_path}/usr/bin/frida-server" "$(pwd)/build-"{arm64,arm64e,arm64eoabi}"-${jb}/subprojects/frida-core/server/frida-server" codesign -vf -s "-" --preserve-metadata=entitlements "${frida_ios_universal_path}/usr/bin/frida-server" lipo "$(pwd)/build-"{arm64,arm64e}"-${jb}/subprojects/frida-core/lib/agent/frida-agent.dylib" -create -output "${frida_ios_universal_path}/usr/lib/frida/frida-agent.dylib" install_name_tool -id 'FridaAgent' "${frida_ios_universal_path}/usr/lib/frida/frida-agent.dylib" codesign -s "$IOS_CERTID" -fv --timestamp=none --generate-entitlement-der "${frida_ios_universal_path}/usr/lib/frida/frida-agent.dylib" arch=$(if [ "${jb}" = "rootless" ]; then echo "arm64"; else echo "arm"; fi) ./subprojects/frida-core/tools/package-server-fruity.sh "iphoneos-${arch}" "${frida_ios_universal_path}" release-assets/"frida_${FRIDA_VERSION}_iphoneos-${arch}.deb" done
- Check the
release-assets/
directory to find your DEBs file. Enjoy!