Last updated

Install Redocly CLI

Choose the most appropriate installation method for your needs:

Install globally

Tip

Make sure you have the newest version of npm/yarn before you begin.

  1. npm
  2. yarn
npm i -g @redocly/cli@latest

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.

  1. Command
  2. Example with lint command
npx @redocly/cli <command> [options]

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:

  1. Docker Hub
  2. GitHub Packages
docker pull redocly/cli

To give a Docker container access to your OpenAPI description files, you need to mount the containing directory as a volume. Assuming the API description is in the current working directory, the command to use is:

docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml

Next steps