# How to Install the pdf-inspector CLI Tool: A Complete Guide

> Easily install the pdf-inspector CLI tool with a single cargo command. This guide shows you how to get pdf-inspector up and running quickly for all your PDF inspection needs.

- Repository: [Firecrawl/pdf-inspector](https://github.com/firecrawl/pdf-inspector)
- Tags: how-to-guide
- Published: 2026-08-13

---

**Install the pdf-inspector CLI tool by running `cargo install pdf-inspector`, which compiles and installs the `pdf2md` and `detect-pdf` binaries to `~/.cargo/bin`.**

The `pdf-inspector` project from Firecrawl provides high-performance Rust-based utilities for extracting and analyzing PDF documents. When you install pdf-inspector CLI tool, you gain access to two specialized binaries designed for modern document processing workflows. This guide covers the complete installation process and initial setup based on the official repository source code.

## Prerequisites: Rust and Cargo

Before installing pdf-inspector, ensure you have the **Rust toolchain** installed on your system. The installation requires **Cargo**, Rust's package manager and build system, which handles downloading and compiling the crate from [crates.io](https://crates.io/crates/pdf-inspector).

If you don't have Rust installed, visit [rustup.rs](https://rustup.rs) to install the toolchain for your operating system. Cargo automatically manages the compilation of Rust source files located in [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs) and [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs) during the installation process.

## Installing pdf-inspector via Cargo

The standard method to install pdf-inspector CLI tool uses Cargo's global install command. This approach downloads the latest stable version and compiles the release binaries optimized for your platform.

Run the following command in your terminal:

```bash
cargo install pdf-inspector

```

This command performs several actions defined in the repository's [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml):

- Downloads the crate and its dependencies from crates.io
- Compiles the `pdf2md` binary from [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs)
- Compiles the `detect-pdf` binary from [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs)
- Installs both executables to `~/.cargo/bin` (or your platform's Cargo binary directory)

As documented in the repository's README under the CLI section (lines 28-34), this single command provides both utilities without requiring separate installations.

## Configuring Your PATH

After installation, ensure Cargo's binary directory is in your system's **PATH** environment variable. By default, this location is `~/.cargo/bin` on Unix-like systems or `%USERPROFILE%\.cargo\bin` on Windows.

Verify the installation by checking the binaries are accessible:

```bash
which pdf2md detect-pdf

```

If the command returns paths to the executables, your installation is complete. If not, add the Cargo bin directory to your PATH configuration file (such as `.bashrc`, `.zshrc`, or Windows Environment Variables).

## Available CLI Commands

The pdf-inspector installation provides two distinct command-line tools, each serving specific PDF processing needs. Both binaries support structured JSON output for integration with automated pipelines.

### Using pdf2md for PDF to Markdown Conversion

The `pdf2md` utility extracts text content from PDF files and converts it to clean Markdown format. According to the implementation in [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs), this tool handles the complete extraction pipeline through a simple interface.

Basic usage:

```bash

# Convert a PDF to Markdown

pdf2md document.pdf

# Output structured JSON for piping to other tools

pdf2md document.pdf --json

```

The `--json` flag returns machine-readable output containing the extracted text and metadata, useful for building automated document processing workflows.

### Using detect-pdf for PDF Classification

The `detect-pdf` binary, implemented in [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs), quickly classifies PDF documents to determine if they contain text-based content, scanned images, or mixed formats. This classification helps determine appropriate processing strategies before extraction.

Basic usage:

```bash

# Classify a PDF document type

detect-pdf document.pdf

# Get classification results as JSON

detect-pdf document.pdf --json

```

This tool runs a fast analysis routine that identifies document characteristics without performing full text extraction, making it efficient for batch processing large document collections.

## Verifying Your Installation

Confirm the pdf-inspector CLI tool installed correctly by checking the version and help documentation:

```bash

# Verify pdf2md installation and view options

pdf2md --help

# Verify detect-pdf installation and view options

detect-pdf --help

```

Successful execution of these commands displays the available flags and confirms the binaries are properly compiled and accessible from your terminal.

## Summary

Installing the pdf-inspector CLI tool provides immediate access to professional-grade PDF processing capabilities:

- **Single command installation** via `cargo install pdf-inspector` builds both binaries from the Rust source
- **Automatic placement** of `pdf2md` and `detect-pdf` in `~/.cargo/bin` for system-wide access
- **Dual utility approach** offering both Markdown extraction (`pdf2md`) and document classification (`detect-pdf`)
- **JSON output support** enabling seamless integration with data pipelines and automation scripts
- **Source-verified reliability** with binaries compiled directly from [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs) and [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs)

## Frequently Asked Questions

### Do I need to install both pdf2md and detect-pdf separately?

No, both binaries install simultaneously when you run `cargo install pdf-inspector`. The [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml) file in the repository defines both `pdf2md` and `detect-pdf` as binary targets, so Cargo compiles and installs both utilities in a single operation. You cannot selectively install only one binary through the crates.io distribution.

### Can I install pdf-inspector without Rust/Cargo?

Currently, the primary distribution method requires Cargo because pdf-inspector is written in Rust. The project builds native binaries from source code located in [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs) and [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs), which requires the Rust compiler. Pre-compiled binaries may become available in future releases, but building from source via Cargo remains the officially supported installation method.

### Where are the pdf-inspector binaries installed on my system?

Cargo installs the binaries to your system's Cargo binary directory, typically located at `~/.cargo/bin` on macOS and Linux. This location must be in your PATH environment variable to invoke `pdf2md` and `detect-pdf` from any directory. You can verify the exact path by running `cargo --list` and checking the installation root, or by examining the compilation output during installation.

### How do I update pdf-inspector to the latest version?

Update your installation by running `cargo install pdf-inspector` again with the `--force` flag, or simply rerun the install command to fetch the latest version from crates.io. Cargo will recompile the updated source files from the repository and replace the existing binaries in `~/.cargo/bin` with the new versions.