Installing DeepSource CLI

The DeepSource CLI helps you access and interact with DeepSource right from your terminal. Here’s how to install it on different platforms.

Homebrew (macOS and Linux)

To install the DeepSource CLI with homebrew, run:

brew install deepsourcelabs/cli/deepsource

Unix/Linux/macOS

To directly install the CLI as a binary, run:

curl https://deepsource.io/cli | sh

This script will detect the operating system and architecture and puts deepsource binary in ./bin/deepsource. You can set a custom location for the CLI installation script to download the binary to using an environment variable, BINDIR. The default location is ./.bin/deepsource (the .bin directory will be created if it doesn’t already exist).

This can be helpful when you want the CLI to be installed to a directory in the PATH, like ~/.local/bin or /usr/local/bin to make it accessible from anywhere:

BINDIR=~/.local/bin curl https://deepsource.io/cli | sh

Windows

  • Download the latest compressed binary from the releases page.
  • Decompress the binary.
  • To invoke the binary, run:
.\deepsource report --analyzer=test-coverage --key=go --value-file=coverage.out.

The CLI requires that the tests are run inside a git repo, and that the git binary is installed. The DEEPSOURCE_DSN value needs to be set in the environment, too.

Supported Platforms

Operating Systems

  • Linux
  • macOS (Darwin)
  • Windows
  • FreeBSD
  • OpenBSD
  • NetBSD

Architectures

  • i386
  • x86_64
  • arm64

Initial Setup

After installation, you’ll need to authenticate the CLI with your DeepSource account.

Authentication

To use DeepSource CLI in your local environment, run:

deepsource auth login

Please copy your one-time code: XYZXYZ
Press enter to open deepsource.io in your browser...

This will open a browser window where you can authenticate with your DeepSource account.

For reporting code coverage in CI environments, you don’t need to authenticate. Instead, you’ll use environment variables like DEEPSOURCE_DSN.