Skip to main content

searchfox-cli

Crates.io PyPI CI

Search Mozilla source code from the terminal: text, identifiers, definitions, call graphs, C++ layouts, and SpiderMonkey GC hazards.

Interface Package
Command line searchfox-cli on crates.io
Rust library searchfox-lib on crates.io
Python bindings searchfox on PyPI; see Python API

Install

cargo install searchfox-cli

Prebuilt binaries are available from GitHub Releases. For Python, use pip install searchfox.

searchfox-cli -q AudioStream
searchfox-cli -q '^Audio.*' -r -C -l 10
searchfox-cli -q AudioStream -p '^dom/media' --cpp
searchfox-cli -p PContent.ipdl
searchfox-cli --id AudioContext
searchfox-cli --define 'AudioContext::CreateGain'
searchfox-cli --get-file dom/media/AudioStream.h --lines 100-150
searchfox-cli -q 'text:function main()' --context 3

--id accepts a source identifier. --symbol expects a mangled symbol from Searchfox output, or an unmangled C function name; use --id for plain C++ names. --context adds surrounding lines to text: and re: queries.

If --define finds no result for a qualified name, try the unqualified method name or a text search. Results may include declarations or other methods with the same name, so check the surrounding code before using them.

The default repository is mozilla-central. Use -R for another repository served by Searchfox, such as mozilla-beta, mozilla-release, or comm-central. Set SEARCHFOX_BASE_URL to use another server:

SEARCHFOX_BASE_URL=http://127.0.0.1:16995 searchfox-cli -q AudioStream

Inspect code

searchfox-cli --calls-from 'mozilla::dom::AudioContext::CreateGain' --depth 2
searchfox-cli --calls-to 'mozilla::AudioCallbackDriver::Start'
searchfox-cli --calls-between 'AudioContext,AudioNode' --depth 2
searchfox-cli --field-layout 'mozilla::dom::AudioContext'
searchfox-cli --can-gc 'JSContext::newObject'
searchfox-cli --function-at dom/media/AudioStream.cpp:42
searchfox-cli --spec-refs 'https://html.spec.whatwg.org/#navigate'
Option Purpose
--cpp, --c, --js, --webidl, --java / --kt Filter by language
--exclude-tests, --exclude-generated Omit those file categories
--only-tests, --only-generated, --only-normal Restrict to one file category
--blame Include commit information
--link, --permalink Return result links instead of source text
--log-requests Show HTTP timing and response sizes

Run searchfox-cli --help for the full option list.

Set MOZTOOLS_UPDATE_CHECK=0 to disable update checks and their notices, for example when running the CLI repeatedly in automation.

File cache

File fetches use a SQLite cache at $XDG_CACHE_HOME/searchfox-cli/cache.db, or ~/.cache/searchfox-cli/cache.db. Contents are fresh for one hour; older entries are revalidated with ETag / Last-Modified when available. Entries older than seven days are pruned when the cache opens.

searchfox-cli --get-file dom/media/AudioStream.h --force-refetch
searchfox-cli --get-file dom/media/AudioStream.h --no-cache
searchfox-cli --clear-cache

Python

from searchfox import SearchfoxClient

client = SearchfoxClient("mozilla-central")
results = client.search(query="AudioStream", limit=10)
source = client.get_definition("AudioContext::CreateGain")

AsyncSearchfoxClient exposes the same operations as awaitables. See the API reference and examples.

Development

cargo test --locked
cargo clippy --locked --all-targets --all-features -- -D warnings

To build the Python extension, activate a virtualenv, install maturin, and run maturin develop --manifest-path searchfox-py/Cargo.toml from the repository root.

Publishing

Pushing a vVERSION tag publishes the Rust crates, binaries, and Python wheels. The tagged commit must contain matching package versions. GitHub write access is enough for routine releases; no local publishing token is needed.

See Publishing for version files, checks, tag commands, release verification, retries, and ownership. just release VERSION is an optional shortcut, not a requirement.

License

MIT OR Apache-2.0.

Metadata

Release files for searchfox 0.21.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for searchfox 0.21.2
File Actions
searchfox-0.21.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for searchfox-0.21.2-cp38-abi3-win_amd64.whl
searchfox-0.21.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for searchfox-0.21.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
searchfox-0.21.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for searchfox-0.21.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
searchfox-0.21.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for searchfox-0.21.2-cp38-abi3-macosx_11_0_arm64.whl
searchfox-0.21.2-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for searchfox-0.21.2-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 22.3 MB

Release files / searchfox-0.21.2-cp38-abi3-win_amd64.whl

Download URL searchfox-0.21.2-cp38-abi3-win_amd64.whl
Size 4.2 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5c8cd0057a5fa8b9c4b26c83e9250e2c6625f94216873a797a1d3d13d8995016
BLAKE2b-256 checksum
How to use checksums
9d25cf5365a0f108cf392ddb86576d01cc2a00fa23d1fa436840275d72198d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / searchfox-0.21.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL searchfox-0.21.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.8 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9e61fd5c86bf63587687bc1475b03dd1fafd695241181ba790ba4e2b57399f91
BLAKE2b-256 checksum
How to use checksums
636c77fd9dc2da59cc3d88fccb9e376217f096562b8924e6ed788327eca4a7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / searchfox-0.21.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL searchfox-0.21.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 4.7 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
f5bee9d4bd54065328f9f2ff827ba1033bdc9f9763f443404f672ca4f743684a
BLAKE2b-256 checksum
How to use checksums
6bde1ee817b995b048050264cb677dda9a837a1a294373a0bf2098ce3dedff8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / searchfox-0.21.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL searchfox-0.21.2-cp38-abi3-macosx_11_0_arm64.whl
Size 4.3 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d19bf2c568e3d794974b3d3209b5e6983e8da4e54f80c4d9b815886290e50ef8
BLAKE2b-256 checksum
How to use checksums
a96907355d82cc671f3f3062edd4f2df13e48486570a1021952960d51928e5b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / searchfox-0.21.2-cp38-abi3-macosx_10_12_x86_64.whl

Download URL searchfox-0.21.2-cp38-abi3-macosx_10_12_x86_64.whl
Size 4.4 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4ef18aa9a42cf0e9a2b784470628cf9d2c2aa690c5eee0c0192600876232c862
BLAKE2b-256 checksum
How to use checksums
ee40030487c81805b5db2d5adb5fbe27c1673d21fd1121e735e984bb9541c6c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for searchfox 0.21.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for searchfox-0.21.2-cp38-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page