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

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

Total release size: 22.2 MB

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

Download URL searchfox-0.21.1-cp38-abi3-win_amd64.whl
Size 4.1 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4263fe28f5ea86844fb412a1f129d7d91515bc41938df8386e263e947cad2606
BLAKE2b-256 checksum
How to use checksums
6d1d932ff56f778ed89e92140664bd809bf5e2ee416c38902053a77e8c9d2ea6
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 23, 2026.

Transparency log

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

Download URL searchfox-0.21.1-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
cb82ec3074e26b0adf9ba8f5b9aea580d7ebfed41c942d1d6e549d091d88da1e
BLAKE2b-256 checksum
How to use checksums
e738e3ac0c654712b41957ba9ccb6283739174fc9603526477e00601da4db3d2
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 23, 2026.

Transparency log

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

Download URL searchfox-0.21.1-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
432919e1e98027ceeea9254915637cf22eb88c51576c285ff1c88697516ed21d
BLAKE2b-256 checksum
How to use checksums
1a6075de4b25a9bb1bc07419bc327b011e3ff7dfc394dba9ef599e64000e3553
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 23, 2026.

Transparency log

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

Download URL searchfox-0.21.1-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
42bc5cfd242d68ad33d550fdf12770853f9e71236effdd38bb525b98eb34a057
BLAKE2b-256 checksum
How to use checksums
180e8cb6dab9c41c8cd8c481d7ebb44f0e5558c68672143ed1ababb83bbb8046
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 23, 2026.

Transparency log

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

Download URL searchfox-0.21.1-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
2483d991ae066fc20575321e0a821b5ce66ec770d6c3430d52709479a5846978
BLAKE2b-256 checksum
How to use checksums
87eb9b9cae946db79f4b85fdb6083f7b6cbbfa3a4f2bedb1afdeb2f5a455a84a
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 23, 2026.

Transparency log

Security for searchfox 0.21.1

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.1-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 23, 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