frida CLI

frida (Frida CLI)

Interactive REPL interface for dynamic instrumentation. Emulates IPython/Cycript-style interactive exploration — tab completion, live object inspection, and hot-reloading scripts.

Prerequisites: frida-tools Python package installed (pip install frida-tools). Target device must be reachable (USB, TCP, or local).


Synopsis

frida [options] [target]

Target can be a process name, PID, or bundle identifier depending on the attach flag used.


Device Selection Options

FlagDescription
-D ID, --device IDConnect to device with the given ID (from frida-ls-devices)
-U, --usbConnect to USB-attached device
-R, --remoteConnect to remote frida-server (default host)
-H HOST, --host HOSTConnect to remote frida-server on HOST
--certificate CERTSpeak TLS with HOST, expecting CERTIFICATE
--origin ORIGINSet Origin header when connecting to remote server
--token TOKENAuthenticate with HOST using TOKEN
--keepalive-interval NKeepalive interval in seconds; 0 to disable (default: -1)
--p2pEstablish peer-to-peer connection with target
--stun-server ADDRESSSet STUN server ADDRESS (used with --p2p)
--relay addr,user,pass,turn-TYPEAdd TURN relay for --p2p (repeatable)
--device-option optionOverride backend-specific option (repeatable)

Target / Attach Options

FlagDescription
-f FILE, --file FILESpawn FILE
-F, --attach-frontmostAttach to the frontmost application
-n NAME, --attach-name NAMEAttach to process by NAME
-N ID, --attach-identifier IDAttach to application by bundle/package identifier
-p PID, --attach-pid PIDAttach to process by PID
-W PATTERN, --await PATTERNAwait a spawn matching PATTERN (gated attach)
--realm REALMRealm to attach in: native (default) or emulated
--runtime RUNTIMEScript runtime: qjs (QuickJS) or v8
--debugEnable Node.js-compatible script debugger (listens on port 5858)
--squelch-crashDo not dump crash report to console
--stdio MODEstdio behavior when spawning: inherit (default) or pipe
--aux optionSet aux option when spawning (repeatable)

Script Options

FlagDescription
-l SCRIPT, --load SCRIPTLoad and execute a script file (repeatable)
-P JSON, --parameters JSONPass parameters as JSON (same format as Gadget config)
-C CMODULE, --cmodule CMODULELoad a CModule (compiled C code)
--toolchain CHOICECModule toolchain: any (default), internal, or external
-c URI, --codeshare URILoad script from Frida CodeShare (user/repo)
-e CODE, --eval CODEEvaluate CODE immediately (repeatable)
-qQuiet mode — no prompt; exit after -l and -e complete
-t N, --timeout NSeconds to wait before exiting in quiet mode; inf to run forever (default: 0)
--pauseLeave main thread paused after spawning (do not auto-resume)
-o FILE, --output FILEWrite log output to FILE
--eternalizeKeep the script alive after the REPL exits
--exit-on-errorExit with code 1 on any unhandled script exception
--kill-on-exitKill the spawned process when Frida exits
--auto-reloadAuto-reload scripts and CModule on file change (default: on)
--no-auto-reloadDisable auto-reload of scripts and CModule
--auto-performWrap entered REPL code with Java.perform() automatically

Global Options

FlagDescription
-O FILE, --options-file FILEText file containing additional command line options
--versionPrint Frida version and exit

Usage Examples

 1# Attach to a local process by name
 2frida Calculator
 3
 4# Attach to Safari on a USB-connected iOS device
 5frida -U Safari
 6
 7# Spawn a binary and attach
 8frida -f /usr/bin/ping
 9
10# Load a script and attach to a process
11frida Calculator -l calc.js
12
13# Load a script, enable Node.js debugger (port 5858)
14frida Calculator -l calc.js --debug
15
16# Attach to an app by bundle ID on USB device
17frida -U -N com.apple.mobilesafari
18
19# Run in quiet/headless mode, evaluate one-liner, then exit
20frida -U -n Safari -e "console.log(ObjC.classes.length)" -q
21
22# Load a CodeShare script
23frida -U -f com.example.app -c "nowsecure/frida-jni-tracer"
24
25# Connect to a remote frida-server
26frida -H 192.168.1.10 -n Spotify

REPL Special Commands

CommandEffect
%reloadManually reload the loaded script from disk
<TAB>Context-aware autocompletion

Built-in REPL Objects

The REPL environment exposes the full Frida JavaScript API:

CategoryObjects
CoreFrida, Process, Module, Memory, Thread
InstrumentationInterceptor, Stalker, MemoryAccessMonitor
Native typesNativePointer, NativeCallback, NativeFunction, ptr, NULL
ObjCObjC (iOS/macOS only)
Java/AndroidJava, Dalvik (Android only)
MiscFile, Socket, DebugSymbol, Instruction, CpuContext
Messagingsend, recv
TimerssetTimeout, clearTimeout, setInterval, clearInterval, gc
UtilitiesWeakRef, console, Proxy

Notes