{"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"install-redocly-cli","__idx":0},"children":["Install Redocly CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Choose the most appropriate installation method for your needs:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"href":"#install-locally"},"children":["Install locally, using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm"]}]}," to make the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly"]}," command available on your system."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"href":"#use-the-command-at-runtime"},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npx"]}," to get the tool at runtime"]}," rather than installing it."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The command is also ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"#docker"},"children":["available through Docker"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"install-locally","__idx":1},"children":["Install locally"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before you begin, make sure you have the newest version of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To install Redocly CLI locally:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In your CLI, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cd"]}," to your project's directory."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter the following command:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npm i @redocly/cli@latest\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["(Optional) Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly --version"]}," to confirm that the installation was successful and the currently-installed version of the tool."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"use-the-command-at-runtime","__idx":2},"children":["Use the command at runtime"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://docs.npmjs.com/cli/v9/commands/npx/"},"children":["npx"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm"]},"'s package runner."," ","It installs and runs a command without installing it globally."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this approach where you can't install a new command, or in a CI context where the command is only used a handful of times."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To run Redocly CLI with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npx"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npx @redocly/cli@latest"]}," to prepend Redocly CLI commands."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npx @redocly/cli@latest <command> [options]\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, to run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly lint"]}," on a file named ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["openapi.yaml"]},", use the following command:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npx @redocly/cli@latest lint openapi.yaml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"run-commands-inside-docker","__idx":3},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"docker"},"children":[]},"Run commands inside Docker"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redocly CLI is available as a pre-built Docker image in ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://hub.docker.com/r/redocly/cli"},"children":["Docker Hub"]}," and ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://github.com/Redocly/redocly-cli/pkgs/container/cli"},"children":["GitHub Packages"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before you begin, make sure you have Docker ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://docs.docker.com/get-docker/"},"children":["installed"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To run Redocly CLI commands inside a docker container:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Pull the image:"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Docker Hub","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"docker pull redocly/cli\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"GitHub Packages","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"docker pull ghcr.io/redocly/cli\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["To give a Docker container access to your OpenAPI description files, mount the containing directory as a volume:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example assumes that the API description file is in your current working folder."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"run-cli-behind-a-proxy","__idx":4},"children":["Run CLI behind a proxy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To run the CLI tool behind a proxy, you can use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTTP_PROXY"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTTPS_PROXY"]}," environment variables to configure the proxy settings."," ","These environment variables specify the proxy server for HTTP and HTTPS traffic, respectively."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"set-up-proxy-environment-variables","__idx":5},"children":["Set up Proxy Environment Variables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To set the proxy environment variables:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open a terminal and use the following command:"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"HTTP proxy","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export HTTP_PROXY=http://your-http-proxy-server:port\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"HTTPS proxy","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export HTTPS_PROXY=https://your-https-proxy-server:port\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-environment-variables-with-cli-commands","__idx":6},"children":["Use Environment Variables with CLI Commands"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To directly include the proxy environment variables in a Redocly CLI command:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prepend the command with the environment variable and its value."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"HTTPS_PROXY=https://your-https-proxy-server:port redocly lint --extends minimal openapi.yaml\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":7},"children":["Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set up ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v1/guides/autocomplete"},"children":["autocomplete for Redocly CLI"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check the full list of ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v1/commands"},"children":["Redocly CLI commands"]}," available."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Try things out with the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://github.com/Redocly/museum-openapi-example"},"children":["Museum Example API"]},"."]}]}]},"frontmatter":{},"tagList":["html","tab","tabs"],"title":"Install Redocly CLI","lastModified":"2025-12-18T14:30:29.000Z"}