> ## Documentation Index
> Fetch the complete documentation index at: https://www.osohq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Setup

> Install and configure the CLI and editor tools for working with Oso Cloud.

## Core development tools

* **Oso Cloud CLI**: validate, test, and deploy Polar policies from the command line.
* **Editor extensions**: syntax highlighting, error detection, and in-editor testing.
* **Local testing**: use the [Oso Dev Server](https://www.osohq.com/docs/develop/local-dev/oso-dev-server.md) for fast iteration without network calls.

## Install the Oso Cloud CLI

```bash theme={null}
# Download and install the latest version
curl -L https://cloud.osohq.com/install.sh | bash

# Verify
which oso-cloud

# Configure credentials
export OSO_AUTH=<your_oso_api_key>
```

The Windows CLI is distributed as an executable. To install it, run the following command from a Windows bash prompt:

```bash theme={null}
Invoke-WebRequest "https://d3i4cc4dqewpo9.cloudfront.net/latest/oso_cli.exe" -OutFile C:\<your_oso_cli_folder>\oso_cli.exe
```

Replace `<your_oso_cli_folder>` with the location of the folder where you want to store the CLI.

Verify the installation succeeded using:

```bash theme={null}
C:\<your_oso_cli_folder>\oso_cli --help
```

Permanently add the `<your_oso_cli_folder>` directory to your PATH by appending it to the PATH environment variable.

**Configure the CLI**

When you use the CLI, it connects to one of your account's environments.

To configure the CLI to use a specific environment:

1. Create or find an API key for the environment you want to use.

2. Store the API key as `OSO_AUTH` for the current bash session:

```bash theme={null}
Set-Item -Path env:OSO_AUTH -Value "<your_oso_api_key>"
```

### Key CLI commands

Once installed, use these commands in your development workflow:

```bash theme={null}
# Validate policy syntax
oso-cloud validate

# Run policy tests
oso-cloud test

# Deploy policies to Oso Cloud or Dev Server
oso-cloud policy "<policy-name>"

# Generate TypeScript types from policies
oso-cloud generate-types
```

```bash theme={null}
# Validate policy syntax
oso_cloud validate

# Run policy tests
oso_cloud test

# Deploy policies to Oso Cloud or Dev Server
oso_cloud policy "<policy-name>"

# Generate TypeScript types from policies
oso_cloud generate-types
```

## Editor integrations

### VS Code

Install the official VS Code extension to enable:

* **Syntax highlighting** for `.polar` files
* **Real-time error detection**
* **Inline test runner**
* **Auto-complete** for built-in Polar functions

**To install:**

1. Open VS Code Extensions panel (`Ctrl+Shift+X`)
2. Search for "Oso"
3. Install the official extension

**Alternative:** Download from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=osohq.oso)

### Other editors

Oso supports the Language Server Protocol (LSP) for syntax validation, auto-completion, and testing. Use any LSP-compatible editor with the CLI as the language server.

> [accordion] Neovim
>
> **Install LSP**:
>
> 1. Install the [oso-cloud CLI](https://www.osohq.com/docs/reference/sdks/install.md)
> 2. Create an LSP config directory: `mkdir ~/.config/nvim/after/lsp/`
> 3. Place the following in `~/.config/nvim/after/lsp/polar.lua`:
>    ```lua theme={null}
>    return {
>        cmd = { "oso-cloud", "lsp" },
>        filetypes = { "polar" }
>    }
>    ```
> 4. Re-launch nvim
> 5. Enable the config: `:lua vim.lsp.enable("polar")`
>
> To troubleshoot issues, run `:checkhealth vim.lsp`.

> [accordion] Console Editors (Vim, Emacs)
>
> Start the LSP server using the CLI:
>
> ```bash theme={null}
> oso-cloud lsp
> ```
>
> Configure your editor to use this LSP for `.polar` files.

> [accordion] JetBrains IDEs (WebStorm, IntelliJ)
>
> **Install syntax highlighting:**
>
> 1. Clone [oso-vscode-extension](https://github.com/osohq/oso-vscode-extension)
> 2. Run `git submodule init` and then `git submodule update` in your local `oso-vscode-extension` repository
> 3. In JetBrains settings: `Editor` → `TextMate bundles` → Add bundle
> 4. Select the cloned `oso-vscode-extension` folder
>
> **Install LSP:**
>
> 1. Install the LSP4IJ plugin
> 2. Go to `Language & Frameworks` → `Language Servers`
> 3. Add new server:
>    * **Command:** `oso-cloud lsp`
>    * **File patterns:** `*.polar`
>    * **Language ID:** `polar`

> [accordion] Zed
>
> **To install:**
>
> 1. Open the Zed extensions panel (`Ctrl+Shift+X`)
> 2. Search for "Oso"
> 3. Install the extension (published by Oso Security, Inc.)

> [accordion] Web-based development
>
> Use the built-in policy editor at [ui.osohq.com](https://ui.osohq.com). No setup required. Supports LSP features out of the box.

## Troubleshooting

> [accordion] CLI Issues
>
> **CLI not found:**
>
> * Check if the binary is in your system PATH
> * Restart your terminal
> * Verify installation by running: `oso-cloud --version`
>
> **Permission denied:**
>
> * Make the binary executable: `chmod +x oso-cloud`
> * Use `sudo` for system-wide installation

> [accordion] Editor Issues
>
> **VS Code extension not working:**
>
> * Restart VS Code
> * Check the Extensions panel for errors
> * Verify `.polar` files have syntax highlighting
>
> **LSP not connecting:**
>
> * Ensure CLI is installed and on PATH
> * Check LSP configuration in your editor
> * Restart the editor

## Next steps

Your development tools are ready. Here's how to start building:

1. **[Set up local testing](https://www.osohq.com/docs/develop/local-dev/oso-dev-server.md)** with the Oso Dev Server
2. **[Write your first policy](https://www.osohq.com/docs/develop/policies/overview.md)** in Polar
3. **[Model your authorization data](https://www.osohq.com/docs/develop/facts/overview.md)** as facts
4. **[Implement authorization checks](https://www.osohq.com/docs/develop/enforce/authorize-requests.md)** in your application


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.