﻿---
title: Install the Elastic CLI
description: Install, update, or uninstall the Elastic CLI with npm, or run it without installing by using npx.
url: https://www.elastic.co/elastic/docs-builder/docs/4118/reference/elastic-cli/cli/installation
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# Install the Elastic CLI
Install the Elastic CLI globally to make the `elastic` command available from your terminal. For occasional use, you can run the CLI through `npx` without installing it.

## Before you begin

To install the CLI, you need to [install Node.js](https://nodejs.org/en/download) 22.12.0 or later. Node.js includes npm. Run `node --version` to check your installed version. The Elastic CLI is tested on Linux, macOS, and Windows, and the installation command is the same on every platform.

## Install globally

1. Install the `elastic` binary to your `PATH`:
   ```bash
   npm install -g @elastic/cli
   ```
2. Verify the installation:
   ```bash
   elastic --version
   ```
   The command prints the installed Elastic CLI version.

If npm reports an `EACCES` error on Linux or macOS, follow the npm instructions for [resolving permissions errors when installing packages globally](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally). Don't rerun the installation with `sudo`.

## Run without installing

To run a one-off command without a permanent install, use `npx`:
```bash
npx -y @elastic/cli --help
```

The command downloads the package to the npm cache, prints the CLI help, and exits.

## Update the CLI

Install the latest version and verify the update:
```bash
npm install -g @elastic/cli@latest
elastic --version
```


## Uninstall the CLI

Remove the global installation:
```bash
npm uninstall -g @elastic/cli
```

This command removes the `elastic` executable. It doesn't remove your configuration file or credentials stored outside the CLI.

## Next steps

- Follow [Get started with the Elastic CLI](https://www.elastic.co/elastic/docs-builder/docs/4118/reference/elastic-cli/cli/quickstart) to connect to Elastic and run your first command.
- [Configure the Elastic CLI](https://www.elastic.co/elastic/docs-builder/docs/4118/reference/elastic-cli/cli/configuration) to connect to your Elasticsearch, Kibana, or Elastic Cloud endpoints.