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
BASHcurl -L https://sourcegraph.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src chmod +x /usr/local/bin/src
or with Homebrew:
BASHbrew install sourcegraph/src-cli/src-cli
or with npm:
BASHnpm install -g @sourcegraph/src
Version compatible with your Sourcegraph instance
Replace sourcegraph.example.com
with your Sourcegraph instance URL:
BASHcurl -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 5.9.347
:
BASHbrew install sourcegraph/src-cli/src-cli@{CURRENT_VERSION_NO_V}
or with npm/npx:
BASHnpx @sourcegraph/src@{CURRENT_VERSION_NO_V} version
Note: Versioned formulas are available on Homebrew for Sourcegraph versions 3.43.2 and later.
Installation: Linux
Latest version
BASHcurl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src chmod +x /usr/local/bin/src
or with npm:
BASHnpm install -g @sourcegraph/src
Version compatible with your Sourcegraph instance
Replace sourcegraph.example.com
with your Sourcegraph instance URL:
BASHcurl -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 5.9.347
:
BASHnpx @sourcegraph/src@{CURRENT_VERSION_NO_V} 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 5.9.347
. To see all versions view sourcegraph/src-cli tags.
BASHdocker run --rm=true sourcegraph/src-cli:latest search 'hello world'