Use our Snyk CLI tool to find and fix known vulnerabilities in your dependencies, both ad hoc and as part of your CI (Build) system.
The Snyk CLI requires you to authenticate with your account before using it. See Authenticate the CLI with your account.
Install the Snyk CLI using one of these options:
Install our Snyk CLI tool using npm.
Prerequisites:
-
Ensure you've installed npm on your local environment, version 8 or greater.
-
To run Snyk on Alpine Linux, first install libstdc++. See this doc for more help.
Steps:
Run these commands to install it for local use:
npm install -g snyk
Once installed, you need to authenticate with your Snyk account:
snyk auth

To test your installation change directory into a folder containing a supported package manifest file (package.json, pom.xml, composer.lock, etc.) and run:
cd /my/project/ snyk test
Alternatively, you can perform a quick test on a public npm package, for instance:
snyk test ionic
As you can see, Snyk found and reported several vulnerabilities in the package. For each issue found, Snyk provides the severity of the issue, a link to a detailed description, the path through which the vulnerable module got into your system, and guidance on how to fix the problem.
You can use a Snyk created Docker container already containing npm, the Snyk CLI and other necessary components. Follow the detailed instructions here https://hub.docker.com/r/snyk/snyk-cli
Once you've completed installation, get started testing and remediating your vulnerabilities with our Getting started guide and our full list of our CLI commands, options and arguments.
From MAC OSx and Linux environments, you can use Homebrew to install our Snyk CLI tool. The repository for installation is stored in our GitHub.
Prerequisites:
-
Supported for MAC OSx and Linux environments only.
-
Ensure Homebrew has already been installed:
brew tap snyk/tap
Steps:
-
Install Snyk as follows:
brew install snyk
From Windows environments, you can use Scoop to install our Snyk CLI tool. The repository for installation is stored in our GitHub.
Prerequisites:
-
Supported for Windows environments only.
-
Ensure Scoop has already been installed:
scoop bucket add snyk https://github.com/snyk/scoop-snyk
Steps:
-
Install Snyk:
scoop install snyk