Ammonia is a modern macOS extension/tweak loader, enabling modifications on Mac systems. SIP must be disabled.
- Turn off SIP
- Install PKG https://github.com/CoreBedtime/ammonia/releases/download/1.5/ammonia.pkg
- Enable arm64e ABI
- sudo nvram boot-args=-arm64e_preview_abi
- Reboot.
sh setup_frida.sh && sh compile.sh && sh package.sh
Ammonia simply loads dynamic libraries at runtime. This allows developers to write and inject functionality directly into the runtime environment with minimal setup.
You must compile for both arm64 & arm64e architectures. (And optionally x86_64 if Rosetta support is desired)
clang -arch arm64 -arch arm64e -dynamiclib -o YourTweak.dylib YourTweak.m
Ammonia will automatically invoke your entrypoint function when the tweak is loaded. You can use any of the following styles:
If you’re writing Objective-C code:
@implementation YourTweak
+ (void)load {
NSLog(@"[!] YourTweak loaded!");
// Your initialization logic here
}
@endFor plain C/C++ tweaks, mark a function with __attribute__((constructor)):
__attribute__((constructor))
static void init_tweak(void) {
printf("[!] Tweak constructor called!\n");
// Initialization code here
}Ammonia can also call a function named void LoadFunction(void *gum_interceptor);. This is called directly after your tweak gets loaded into runtime.
This acts similarly to a main() for your tweak. Make sure this symbol is exported.
Example:
void LoadFunction(void *gum_interceptor) {
printf("[!] LoadFunction called with gum interceptor %p\n", gum_interceptor);
}