Install or update the Snyk CLI
You can install the Snyk CLI using the methods explained on this page.
After you install the Snyk CLI, you must authenticate. Then you can get started testing and fixing your vulnerabilities, beginning with testing your installation.

Install the Snyk CLI with npm or Yarn

Before installing the Snyk CLI using npm, be sure you have installed the prerequisites:
Then follow these steps to install with npm or Yarn:
Snyk CLI is available as an npm package. If you have Node.js installed locally, you can install the npm package by running npm install snyk -g.
If you are using Yarn, install by running yarn global add snyk.

Install with standalone executables

Use GitHub Releases to download a standalone executable (macOS, Linux, Windows) of Snyk CLI for your platform.
Snyk also provides these standalone executables on the Snyk Content Delivery Network (CDN). See https://static.snyk.io/cli/latest/release.json for the download links. Examples for a specific version or platform follow:
For example, to download and run the latest Snyk CLI on macOS, you could run:
1
curl https://static.snyk.io/cli/latest/snyk-macos -o snyk
2
chmod +x ./snyk
3
mv ./snyk /usr/local/bin/
Copied!
You can also use these direct links to download the executables:
For Apple M1 (darwin/arm64), see: How do I run Snyk CLI on an Apple M1 machine?
Note: The drawback of this method is that you must keep the Snyk CLI up to date manually.

Install with Homebrew (macOS, Linux)

Install Snyk CLI from Snyk's tap with Homebrew by running the following. The tap is updated daily with the latest Snyk CLI release.
1
brew tap snyk/tap
2
brew install snyk
Copied!
For Apple M1 (darwin/arm64), see: How do I run Snyk CLI on an Apple M1 machine?

Install with Scoop (Windows)

Install Snyk CLI from Snyk's bucket with Scoop by running the following. The bucket is updated daily with the latest Snyk CLI release.
1
scoop bucket add snyk https://github.com/snyk/scoop-snyk
2
scoop install snyk
Copied!

Snyk CLI in a Docker image

Snyk CLI can also be run from a Docker image. Snyk offers multiple Docker images under snyk/snyk-cli and snyk/snyk (see snyk/snyk-images on GitHub for more details).
These images wrap the Snyk CLI and depending on the Tag come with relevant tooling for different projects, for example, for scanning a Gradle project with snyk/snyk-cli:
1
docker run -it \
2
-e "SNYK_TOKEN=<TOKEN>" \
3
-v "<PROJECT_DIRECTORY>:/project" \
4
-v "/home/user/.gradle:/home/node/.gradle" \
5
snyk/snyk-cli:gradle-5.4 test --org=my-org-name
Copied!

Install as a part of a Snyk integration

Snyk also offers many integrations into developer tooling. These integrations install and manage the Snyk CLI for you. Integrations include the following:
See the integrations docs for more details.