Connect Cortex CLI
Connect Cortex CLI to scan supported Cortex Cloud modules and gain insights into your security posture, enabling you to identify, analyze and address potential risks.
You can choose from three main installation workflows:
Package Manager: The most efficient developer workflow, utilizing Homebrew for macOS/Linux and Scoop for Windows
Manual download: Directly download the binaries for any operating system
UI-based installation: Onboard and download the CLI directly from your tenant
Workflow 1: Install through a Package Manager
Using a package manager is the recommended method for installing the Cortex CLI. Use Homebrew (for macOS and Linux) or Scoop (for Windows).
macOS & Linux (Homebrew)
Supported on macOS (Apple Silicon & Intel) and Linux (x86_64 & arm64).
Requires Homebrew.
Standard installation
Pinning to a specific version (optional)
If your workflow requires a specific version, use one of the following methods instead:
Pin to a release line (for example stay with v 0.18.x )
Use this method to lock the CLI to a specific minor version but still receive automatic security patches.
Pin to an exact version (for example exactly 0.18.0):
Use this method to strictly lock the CLI to a precise build. This prevents all automatic updates.
Windows (Scoop)
Supported on Windows x64.
Requires Scoop.
Standard installation
Install a specific version (optional)
If your workflow requires a specific version, use this method instead:
Workflow 2: Manual download (any OS)
You can manually download the binaries for macOS, Linux, or Windows.
Step 1: Download the binary.
Retrieve the specific archive for your platform from the releases page.
macOS / Linux: Download the appropriate
.tar.gzarchive for your system architectureWindows: Download the appropriate
.ziparchive
Step 2: Verify and Extract.
Verify the download against the SHA256SUMS file provided on the releases page, then extract the archive.
macOS / Linux: The extracted executable will be named
cortexcliWindows: The extracted executable will be named
cortexcli.exe
Step 3: Add to PATH.
Place the extracted file in a directory that is included in your system's PATH so you can run it from any terminal.
macOS / Linux: Move cortexcli to a directory such as
/usr/local/bin/Windows: Move
cortexcli.exeto a dedicated folder and add that folder's path to your system's Environment Variables
Workflow 3: UI-Based Installation
This method allows you to install the CLI directly from your tenant. Instead of downloading a standard installation file through your web browser, the Cortex UI generates a custom installation command that you must run in your terminal to securely pull and authenticate the CLI binary.
Step 1: Generate the installation command (in the UI)
On your tenant.
Navigate to Settings → Data Sources → + Data Source.
Enter Cortex CLI in the search bar → Hover over the Cortex CLI card → Connect or Connect Another Instance.
On the Configure step of the integration wizard, select your operating system from the menu and click Next.
On The Authenticate step of the wizard.
Generate an API:
Select Generate API key. Permission options:
With upload results permissions. Creates a CLI role for the API key with CLI View/Edit options. It is recommended as it grants the API key permissions to not only access data, but also to upload or send data back
If you do not select this option, the generated API key creates a CLI Read Only role with CLI View permissions only
Copy and save the the generated
API Key IDandAPI keythat are displayed in their respective fields.Verify that the generated API key is displayed under the API Keys inventory.
Step 2: Download the CLI (in your terminal).
Before running the command, you may need to insert your specific credentials into the code you just copied:
If the code contains placeholders, replace
${API_KEY}with the API key you saved.If needed, retrieve your public API URL by navigating to Settings → Configurations → API Keys and clicking Copy API URL, then paste it into the code.
Paste the finalized copied command into your local terminal and press Enter. The command you are running uses the following underlying syntax:
What this does: This securely connects to your specific Cortex tenant (
$CORTEX_FQDN) using your newly generated API credentials and downloads thecortexcliapplication directly to your current folder.
Step 3: Make the CLI Executable (macOS & Linux only).
By default, macOS and Linux restrict downloaded files from running as programs. You must explicitly grant the downloaded file permission to execute by running:
Step 4: Verify the installation.
Confirm that the CLI was downloaded and authenticated successfully by asking it to report its version. The command you use depends on where the file is currently located:
If you moved the file to a directory on your system
PATH:If the file is still in your current download folder (not in your system
PATH):
If the terminal displays the version number, the installation is complete and the CLI is ready to use. You can now return to the Cortex Cloud UI and click Done.
Post-installation actions
Use the following methods to manage your CLI application lifecycle after the initial installation. You can use either the automated download script or package managers for both your CI/CD pipelines and local end-user environments.
Method 1: Package managers
Manage the CLI lifecycle using your system's package manager.
macOS and Linux
Upgrade to latest version
Freeze whatever you have now (blocks
brew upgradefrom touching it)Uninstall
Windows
Upgrade to latest version
Prevent upgrades
Allow upgrades again
Uninstall
Method 2: Automated download script
To upgrade your CLI to the latest version, you can run the automated download script. This script will fetch the most recent release, make it executable, and overwrite your existing binary.
Required environment variable substitutions
CORTEX_API_KEY: Your API key<CORTEX_API_URL>: Your tenant API base URL<AUTH_ID>: Your API key ID value<OS>: Your operating system (linux,darwin, orwindows)<ARCH>: Your system architecture (such asamd64,arm64)
How it works
The script:
Requests a signed download link from Cortex Cloud for the latest release matching your OS and architecture.
Parses the JSON response using
jqto extract the temporary download URL (signed_url) and the target binary file name (file_name).Downloads the new binary with a second curl call to the signed URL, replacing your older version of the CLI.
Troubleshooting
cortexcli --version shows a different version than I just installed
You likely have an older copy of cortexcli earlier on your PATH — for example from the macOS .pkg installer, a manual download, or a previous tenant download. The shell is finding that one first.
Find every copy:
macOS / Linux which -a cortexcli
Windows (PowerShell) where.exe cortexcli
Expected location for the package-manager install:
macOS (Homebrew):
/opt/homebrew/bin/cortexclior/usr/local/bin/cortexcliLinux (Homebrew):
/home/linuxbrew/.linuxbrew/bin/cortexcliWindows (Scoop):
%USERPROFILE%\scoop\shims\cortexcli.exe
Remove the old copy:
macOS
.pkginstaller →sudo rm /usr/local/bin/cortexcliManual / tenant download → delete the binary at the path shown by
which -a/where.exeWindows installer → uninstall via Settings → Apps → Installed apps, or delete the
.exeshown bywhere.exe
Finalize:
Open a new terminal (so the shell drops its command cache) and re-run cortexcli --version.
Last updated
Was this helpful?
