| description | Install, update, or uninstall the Elastic CLI with npm, or run it without installing by using npx. | ||||
|---|---|---|---|---|---|
| applies_to |
|
||||
| type | how-to |
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.
:::{include} _snippets/installation-requirements.md :::
-
Install the
elasticbinary to yourPATH:npm install -g @elastic/cli
-
Verify the installation:
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. Don't rerun the installation with sudo.
To run a one-off command without a permanent install, use npx:
npx -y @elastic/cli --helpThe command downloads the package to the npm cache, prints the CLI help, and exits.
Install the latest version and verify the update:
npm install -g @elastic/cli@latest
elastic --versionRemove the global installation:
npm uninstall -g @elastic/cliThis command removes the elastic executable. It doesn't remove your configuration file or credentials stored outside the CLI.
- Follow Get started with the Elastic CLI to connect to Elastic and run your first command.
- Configure the Elastic CLI to connect to your {{es}}, {{kib}}, or {{ecloud}} endpoints.