The Snyk CLI helps you find and fix known vulnerabilities in your dependencies, both manually and as part of your continuous integration (CI) workflow.
Installing the Snyk CLI
Here's how to install Snyk using a few different tools:
npm install -g snyk
brew tap snyk/tap brew install snyk
scoop bucket add snyk https://github.com/snyk/scoop-snyk
- A manual installer is available from Snyk’s GitHub.
For more detailed installation guidance and options, see our article on how to Install the Snyk CLI.
Authenticate from the browser
To associate your Snyk account with the CLI, you must first authenticate your account. No repository permissions are needed at this stage, only your email address.
snyk authfrom the CLI. A browser tab will open, redirecting you to authenticate the CLI for use with your account.
- Click Authenticate, and go back to your terminal.
For more authentication options and information, see our article on authenticating the CLI with your account.
Test for vulnerabilities
Once installed and authenticated, change directory into a folder containing a supported package manifest file (package.json, pom.xml, composer.lock, etc.) and run:
All vulnerabilities identified are listed, including their path and remediation guidance. To monitor your project regularly and receive ongoing notifications when new vulnerabilities are introduced, see our article on monitoring your projects at regular intervals.
Monitor your project
New vulnerabilities are constantly disclosed - which is where monitoring comes in. Once you set up your project to be monitored, Snyk regularly tests your code and notifies you whenever new vulnerabilities are found in your project.
- Open a terminal from your project directory and run
This command takes a snapshot of your current dependencies so we can regularly scan your project and notify you about newly disclosed vulnerabilities as they are introduced, or when a previously unavailable patch or upgrade path is published.
Log into Snyk and go to the Projects tab to see the latest snapshot and test results.
snyk help or see Our full CLI reference.