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

# Mac Setup for Local Code Scanning

> Install and run the CybeDefend CLI on macOS for secure local code scanning.

This guide walks you through installing the **CybeDefend CLI** on macOS, ensuring you can quickly scan projects locally.

## Requirements

* **macOS** (Intel or Apple Silicon).
* [Personal Access Token (PAT)](/latest/code-scanning/local-code-scanning/introduction-api-key) from your CybeDefend account.
* Optional: Homebrew or direct binary installation.

***

## Installation Methods

### 1. Homebrew (Recommended)

```bash theme={null}
brew tap cybedefend/cli
brew install cybedefend
```

Check version:

```bash theme={null}
cybedefend version
```

### 2. Direct Download

1. **Download**: `cybedefend-darwin-amd64` (for Intel) or `cybedefend-darwin-arm64` (for M1/M2) from [Releases](https://github.com/CybeDefend/cybedefend-cli/releases).
2. **Make Executable**:
   ```bash theme={null}
   chmod +x cybedefend-darwin-*
   ```
3. **Move to /usr/local/bin**:
   ```bash theme={null}
   sudo mv cybedefend-darwin-* /usr/local/bin/cybedefend
   ```
4. **Verify**:
   ```bash theme={null}
   cybedefend --help
   ```

<Note>
  If you encounter a macOS Gatekeeper prompt, right-click the binary in Finder → Open, or remove quarantine attributes with <code>xattr -d com.apple.quarantine cybedefend-darwin-\*</code>.
</Note>

***

## Scanning on macOS

1. **Navigate to Your Code**
   ```bash theme={null}
   cd ~/Projects/my-app
   ```
2. **Authenticate (one-time setup)**
   ```bash theme={null}
   cybedefend login --pat YOUR_PAT --region eu
   ```
3. **Run a Scan**
   ```bash theme={null}
   cybedefend scan --dir . --project-id YOUR_PROJECT_ID
   ```
4. **Check Results**
   ```bash theme={null}
   cybedefend results --project-id YOUR_PROJECT_ID --all
   ```

<Tip>
  You can also store your PAT in the <strong>CYBEDEFEND\_PAT</strong> environment variable to avoid typing it each time:

  ```bash theme={null}
  export CYBEDEFEND_PAT=your_pat_here
  ```
</Tip>
