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.0

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.0
File Actions
searchfox-0.21.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for searchfox-0.21.0-cp38-abi3-win_amd64.whl
searchfox-0.21.0-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.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
searchfox-0.21.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for searchfox-0.21.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
searchfox-0.21.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for searchfox-0.21.0-cp38-abi3-macosx_11_0_arm64.whl
searchfox-0.21.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for searchfox-0.21.0-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 22.2 MB

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

Download URL searchfox-0.21.0-cp38-abi3-win_amd64.whl
Size 4.1 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c98169be68f6a383802b123a3bc9062ee552409f080ccb6cdab0b52324d6648c
BLAKE2b-256 checksum
How to use checksums
fe72bc3400b5e321d14ed511aa1d04a56da35a5b657f03cb85c848ef378031c0
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 19, 2026.

Transparency log

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

Download URL searchfox-0.21.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8ddbd101ac6ff50c7516e8a594b6099aa1fc8ba278f4eae27600c5cd83a27034
BLAKE2b-256 checksum
How to use checksums
207f24b5e3e0efc02af8bcc009f1c099cf9fa852b678e840343239e6c15cc137
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 19, 2026.

Transparency log

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

Download URL searchfox-0.21.0-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
9adc6d653b2be682b1596ae5dd3f2fb82c407a8bab99a7e46ae04e377aef1c75
BLAKE2b-256 checksum
How to use checksums
cd4bf997d39e7d3d912037fbd28bffcf12b883d8641215f9fdc16339ff567e04
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 19, 2026.

Transparency log

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

Download URL searchfox-0.21.0-cp38-abi3-macosx_11_0_arm64.whl
Size 4.2 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e931619a2d7bc53ef2ffa35436b1009846540212411fcd1926380853094d822d
BLAKE2b-256 checksum
How to use checksums
d2c126e76cda9e82f811837155b288751b5e5a5d0615355d51b02d17adf4601a
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 19, 2026.

Transparency log

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

Download URL searchfox-0.21.0-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
ac41078c01d9bfaf32838e488c908b4bb40f869f1ffd1824f2086d7946071994
BLAKE2b-256 checksum
How to use checksums
6fe442896c4f6ae5d3cbbb620f58805a37faf024eb480d42355338205732e187
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 19, 2026.

Transparency log

Security for searchfox 0.21.0

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.0-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 19, 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