Installation & versioning

Binary downloads are available on the releases tab, and through Sourcegraph.com. If the latest version does not work for you, consider using the version compatible with your Sourcegraph instance instead.

Installation: Mac OS

Latest version

curl -L https://sourcegraph.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

or with Homebrew:

brew install sourcegraph/src-cli/src-cli

or with npm:

npm install -g @sourcegraph/src

Version compatible with your Sourcegraph instance

Replace sourcegraph.example.com with your Sourcegraph instance URL:

curl -L https://sourcegraph.example.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

or, if you know the specific version to target, for example 3.43.2:

brew install sourcegraph/src-cli/[email protected]

or with npm/npx:

npx @sourcegraph/[email protected] version

Note: Versioned formulas are available on Homebrew for Sourcegraph versions 3.43.2 and later.

Installation: Linux

Latest version

curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

or with npm:

npm install -g @sourcegraph/src

Version compatible with your Sourcegraph instance

Replace sourcegraph.example.com with your Sourcegraph instance URL:

curl -L https://sourcegraph.example.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src

or, with npm/npx, if you know the specific version to target, for example 3.43.2:

npx @sourcegraph/[email protected] version

Installation: Windows

See Sourcegraph CLI for Windows.

Installation: Docker

sourcegraph/src-cli is published to Docker Hub. You can use the latest tag or a specific version such as 3.43. To see all versions view sourcegraph/src-cli tags.

docker run --rm=true sourcegraph/src-cli:latest search 'hello world'