2.1 KiB
Install Redocly CLI
Choose the most appropriate installation method for your needs:
- Install locally, using
npmoryarnto make theredoclycommand available on your system. - Use
npxto get the tool at runtime rather than installing it. - The command is also available via Docker if you'd prefer to use it that way.
Install globally
:::success Tip
Make sure you have the newest version of npm/yarn before you begin.
:::
npm i -g @redocly/cli@latest
yarn global add @redocly/cli
Running redocly --version confirms that the installation was successful, and the currently-installed version of the tool.
Use npx at runtime
npx is npm's package runner. It installs and runs a command without installing it globally. You might use this where you can't install a new command, or in a CI context where the command is only used a handful of times.
npx @redocly/cli <command> [options]
npx @redocly/cli@latest lint petstore.yaml
Run commands inside Docker
Redocly CLI is available as a pre-built Docker image in Docker Hub and GitHub Packages.
Install Docker if you don't have it already, then pull the image with the following command:
docker pull redocly/cli
docker pull ghcr.io/redocly/cli
To give a Docker container access to your OpenAPI definition files, you need to mount the containing directory as a volume. Assuming the definition is in the current working directory, the command to use is:
docker run --rm -v $PWD:/spec redocly/cli lint petstore.yaml
Next steps
- Set up autocomplete for Redocly CLI.
- Check the full list of Redocly CLI commands available.