Ghidra Downloadindependent download & install guide
English
HEADLESS ANALYSIS

Ghidra Headless Analyzer: Batch Analysis from the CLI

The Ghidra Headless Analyzer runs Ghidra without its graphical interface. Use the analyzeHeadless launcher in the installation's support folder to import authorized binaries, process an existing project, run pre- and post-scripts, and repeat the same workflow across files. This guide explains which command to choose, how to protect project data, how to read the result, and how to troubleshoot a failed run.

Open official Headless Analyzer documentation
Best forRepeatable batch analysis
Entry pointsupport/analyzeHeadless
Core modes-import and -process
Checked releaseGhidra 12.1.3 · Sep 16, 2026
QUICK ANSWER

Ghidra Headless Analyzer: What It Is and When to Use It

The Ghidra Headless Analyzer is the command-line entry point for running Ghidra analysis without opening the desktop interface. It can create or populate a project, analyze imported or existing programs, and run non-GUI scripts for sample folders, firmware triage, scheduled reports, or controlled build pipelines.

Headless is not a remote server and it does not make every conclusion automatic. The launcher still depends on a Ghidra installation, project location, loaders, analyzers, scripts, and normal project rules. Record the release, input set, options, output project, and log, and analyze only authorized material.

Keep the source of truth visible

The official documentation and the release-matched support/analyzeHeadless launcher define the available options. This page explains a safe workflow, but it does not replace the help bundled with your installed release.

BEFORE THE COMMAND

Prepare the installation, project, and input files

Start with the official Ghidra ZIP and a matching 64-bit JDK. The release verified for this site is Ghidra 12.1.3, published August 18, 2026, and its archive includes the launcher under support/. Follow the site's Ghidra installation guide if the desktop application has not started; a broken JDK or incomplete extraction also breaks headless runs.

Keep the application, project, and input/report directories separate. Do not edit a live project from a batch job or overwrite a known-good copy before inspecting the new run. Use a new project name while testing scripts or analyzer options.

  1. 1

    Confirm the launcher

    From the Ghidra installation, check that the platform launcher exists and can print help. Windows uses the batch file; macOS and Linux use the shell launcher.

    support/analyzeHeadless.bat OR support/analyzeHeadless
  2. 2

    Choose a writable project root

    Use a directory with enough space for imported programs, databases, caches, and reports. Avoid a synchronized folder while diagnosing file-lock or concurrent-write problems.

    D:\analysis\projects /srv/ghidra/projects
  3. 3

    Record the input set

    Write down the file names, hashes, architecture assumptions, and collection date. A directory path is not a reproducible input unless its contents are recorded.

    samples/firmware-a.bin samples/firmware-b.bin
  4. 4

    Back up before processing

    Copy a project before running a script that renames symbols, changes data types, deletes programs, or saves upgraded data.

    ProjectName.gpr + ProjectName.rep/
Official Ghidra Project Window showing a project and imported executable files
Official Ghidra Project Window screenshot: keep project data separate from the application directory and back it up before automation changes it.
CHOOSE A MODE

Choose -import or -process

The key Headless Analyzer decision is whether the command should create or populate a project from input files, or reopen programs already in a project. Use -import for a file or directory that should become project programs. Use -process when the project already contains the program.

Do not add both modes just because an online example does. Start with one explainable job, specify a loader or processor only when needed, and save the successful command in a versioned script.

TaskModeTypical inputWhat to verify
Create a project from binaries-importFile or directoryLoader, language, project name
Analyze programs already in a project-processExisting projectProgram names and project copy
Run a script during import-import + -postScriptNew input setScript path and saved output
Process a directory of project programs-process + -recursiveExisting project treeScope and log per run
Windows: import a practice samplecd C:\ghidra_12.1.3_PUBLIC\support analyzeHeadless.bat D:\analysis\projects HeadlessDemo -import D:\analysis\samples\demo.exe
Linux or macOS: process an existing project./support/analyzeHeadless /srv/ghidra/projects HeadlessDemo -process demo.exe
AUTOMATION

Use scripts without losing repeatability

Headless jobs become more useful when a script turns analysis state into a small, reviewable result. A pre-script can prepare a project action; a post-script can inspect the analyzed program and write a report. Keep scripts narrow: printing functions, strings, imports, or one metadata field is easier to test than silently renaming a large project.

Put scripts in a versioned directory and pass it with -scriptPath. Use -preScript and -postScript for explicit hooks and capture the supported log output. If you need CPython outside Ghidra, read the site's PyGhidra guide; the two automation boundaries are related but different.

  • Start with a read-only or reporting task and a small authorized sample.
  • Pin the script revision beside the command and the Ghidra release.
  • Write reports outside the project directory unless the script must save project data.
  • Test an empty result, a missing field, an unsupported program type, and a second run.
  • Compare a backed-up project before accepting symbol or data-type changes.
Editorial concept illustration connecting a Ghidra script workflow to program analysis and a function graph
Editorial concept illustration: keep headless scripts small, versioned, and easy to compare with the resulting program evidence.
REPEATABLE RUNS

Batch directories, logs, and CI jobs

For a directory workflow, decide whether files should share one project or use isolated projects. One project helps cross-file navigation; separate projects reduce accidental mixing. Use -recursive only when nested folders are in scope because a broad path can import more data than expected.

Record the command, Ghidra release, Java version, input manifest, script revision, exit status, logs, project path, and files with unexpected output. In CI, archive logs and reports and fail when the launcher or post-script reports an error. A green process is not proof that every expected function or string was found.

Avoid hidden state

The same command can produce different conclusions when the input directory, project profile, extension set, script revision, or Ghidra release changes. Record those boundaries next to the report.

A bounded recursive import./support/analyzeHeadless /srv/ghidra/projects BatchSet -import /srv/ghidra/samples -recursive -scriptPath /srv/ghidra/scripts -postScript export_summary.py
A practical run recordrelease=12.1.3 input_manifest=sha256.csv script=export_summary.py@abc123 project=BatchSet log=run-2026-09-16.log
VERIFY THE OUTPUT

Read the result and verify it in Ghidra

After a headless run, inspect the exit status and log before opening the project. Check loader messages, language or compiler choices, analysis completion, script exceptions, skipped files, and write failures. Then open a copy in the GUI and verify a small sample in Listing, references, Decompiler, or symbols. The Ghidra search guide and Decompiler guide cover these checks.

A report is an output artifact, not proof by itself. If a script finds no strings, confirm the language, scope, and API object. Keep the input manifest and exact run record beside saved project data.

SymptomFirst checkSafer next step
No program appearsImport mode, path, loaderRun one file with a new project name
Script is not foundScript path and filenameUse an absolute script directory and a tiny test script
Analysis is incompleteLog, timeout, memory, analyzer messagesRetry one sample and compare the project copy
Output disagrees with GUIRelease, language, options, script phaseVerify the same program and settings in both paths
Official Ghidra CodeBrowser Listing showing loaded program memory, instructions, and references
Official Ghidra CodeBrowser screenshot: validate a headless report against address-level program evidence instead of trusting a single summary line.
CHOOSE THE RIGHT AUTOMATION

Headless Analyzer vs Script Manager and PyGhidra

The Headless Analyzer is the CLI job boundary. Script Manager runs scripts inside the visible Ghidra application. PyGhidra connects an external CPython process to Ghidra's API. They can appear in one investigation, but they are different runtimes.

Use the GUI for one program and visual feedback, Headless Analyzer for repeatable imports or project jobs, and PyGhidra when an external Python process is the main requirement.

Tool boundaryBest fitMain caution
Headless AnalyzerCLI batch imports and project jobsRecord project, release, scripts, and logs
Script ManagerVisible in-application scriptsRuntime context and current project matter
PyGhidraExternal CPython automationPython and Ghidra compatibility must match
HEADLESS ANALYZER FAQ

Ghidra Headless Analyzer FAQ

Where is analyzeHeadless in Ghidra?

It is in the Ghidra installation's support/ directory. Windows provides analyzeHeadless.bat; Linux and macOS use the shell launcher. Use the launcher that belongs to the release you installed.

What is the difference between -import and -process?

Use -import when the job starts with files or a directory and needs to create or populate a project. Use -process when programs already exist in the project and the job should process them.

Can Ghidra analyze many files without the GUI?

Yes. The Headless Analyzer can import or process a directory, and options such as -recursive can extend the intended scope. Start with a small authorized set and record the manifest so a batch result can be checked.

Can I run a script with analyzeHeadless?

Yes. Use the script-path and pre- or post-script options supported by your installed release. Keep scripts versioned, test them on a copy, and capture logs and reports beside the command record.

Does Headless Analyzer require a Ghidra project?

The launcher works with a project location and project name. An import job can create or populate project data, while a process job expects programs that are already in the project. Keep the project path writable and separate from the application directory.

Is Headless Analyzer the same as PyGhidra?

No. Headless Analyzer is the command-line job launcher for imports, project processing, and Ghidra scripts. PyGhidra connects an external CPython process to Ghidra's API. Pick the boundary that matches the automation you need.