---
sidebar_label: "Environment Setup"
sidebar_custom_props:
  section: "Templates"
  section_position: 1
---

{/*

Environment Setup pages guide users through installation and preparation of their development 
environment. Include prerequisites, step-by-step installation instructions for multiple platforms, 
and verification steps to ensure everything is working correctly.

*/}

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Environment Setup Template

Complete guide to installing and configuring your development environment.

## Prerequisites

Before you begin, ensure you have the following installed:

- **Operating System:** Linux, macOS, or Windows 10/11
- **Required Software:**
  - Node.js 18.x or higher
  - Git 2.x or higher
  - A text editor or IDE (VS Code, IntelliJ, etc.)

## Installation

<Tabs groupId="operating-systems">
<TabItem value="linux" label="Linux">

### Using Package Manager

```bash title="install.sh"
# Ubuntu/Debian
curl -fsSL https://example.com/install.sh | bash
sudo apt-get update
sudo apt-get install -y example-tool

# Fedora/RHEL
sudo dnf install -y example-tool

# Arch Linux
sudo pacman -S example-tool
```

### Manual Installation

```bash
# Download and extract
wget https://example.com/releases/latest/example-tool-linux.tar.gz
tar -xzf example-tool-linux.tar.gz
sudo mv example-tool /usr/local/bin/

# Verify installation
example-tool --version
```

</TabItem>
<TabItem value="macos" label="macOS">

### Using Homebrew

```bash
# Install via Homebrew (recommended)
brew tap example/tap
brew install example-tool

# Verify installation
example-tool --version
```

### Manual Installation

```bash
# Download and install
curl -L https://example.com/releases/latest/example-tool-macos.tar.gz -o example-tool.tar.gz
tar -xzf example-tool.tar.gz
sudo mv example-tool /usr/local/bin/

# Verify installation
example-tool --version
```

</TabItem>
<TabItem value="windows" label="Windows">

### Using Package Manager

```powershell
# Using Chocolatey
choco install example-tool

# Using Scoop
scoop install example-tool

# Using Winget
winget install Example.Tool
```

### Manual Installation

1. Download the installer from [releases page](https://example.com/releases)
2. Run the `.exe` or `.msi` installer
3. Follow the installation wizard
4. Add to PATH if not done automatically

```powershell
# Verify installation
example-tool --version
```

</TabItem>
</Tabs>

## Configuration

### Initial Setup

After installation, run the initialization command:

```bash
# Initialize configuration
example-tool init

# Configure user settings
example-tool config set user.name "Your Name"
example-tool config set user.email "your.email@example.com"
```

### Configuration File

Create a configuration file in your home directory:

```yaml title="~/.example-tool/config.yml"
user:
  name: Your Name
  email: your.email@example.com

defaults:
  editor: code
  shell: bash

preferences:
  auto_update: true
  telemetry: false
```

## Development Environment

### Setting Up a Project

```bash
# Create a new project directory
mkdir my-project
cd my-project

# Initialize the project
example-tool init --template basic

# Install dependencies
npm install
```

### Environment Variables

Set up required environment variables:

```bash title=".env"
# API Configuration
EXAMPLE_API_KEY=your_api_key_here
EXAMPLE_ENDPOINT=https://api.example.com

# Development Settings
NODE_ENV=development
LOG_LEVEL=debug
```

Load environment variables:

<Tabs>
<TabItem value="bash" label="Bash/Zsh">

```bash
# Add to ~/.bashrc or ~/.zshrc
export EXAMPLE_API_KEY="your_api_key_here"
export EXAMPLE_ENDPOINT="https://api.example.com"
```

</TabItem>
<TabItem value="fish" label="Fish">

```fish
# Add to ~/.config/fish/config.fish
set -x EXAMPLE_API_KEY "your_api_key_here"
set -x EXAMPLE_ENDPOINT "https://api.example.com"
```

</TabItem>
</Tabs>

## Verification

Verify your installation is working correctly:

```bash
# Check version
example-tool --version

# Run diagnostic
example-tool doctor

# Test basic functionality
example-tool test connection
```

Expected output:

```
✓ Example Tool v1.2.3
✓ Configuration loaded
✓ API connection successful
✓ All systems operational
```

## Updating

Keep your installation up to date:

<Tabs groupId="operating-systems">
<TabItem value="linux" label="Linux">

```bash
# Update via package manager
sudo apt-get update && sudo apt-get upgrade example-tool

# Or use built-in updater
example-tool update
```

</TabItem>
<TabItem value="macos" label="macOS">

```bash
# Update via Homebrew
brew upgrade example-tool

# Or use built-in updater
example-tool update
```

</TabItem>
<TabItem value="windows" label="Windows">

```powershell
# Update via package manager
choco upgrade example-tool

# Or use built-in updater
example-tool update
```

</TabItem>
</Tabs>

## Troubleshooting Installation

### Command Not Found

If you get "command not found" errors:

```bash
# Check if installed
which example-tool

# Check PATH
echo $PATH

# Add to PATH manually
export PATH="$PATH:/path/to/example-tool"
```

### Permission Denied

On Linux/macOS, you may need to make the binary executable:

```bash
chmod +x /usr/local/bin/example-tool
```

### Port Already in Use

If the default port is occupied:

```bash
# Use a different port
example-tool start --port 9000

# Or stop the conflicting process
lsof -ti:8080 | xargs kill -9
```

:::tip Next Steps
Once your environment is set up, check out the [Quick Start](#) guide to create your first project.
:::

:::note System Requirements
- **Minimum:** 2GB RAM, 500MB disk space
- **Recommended:** 4GB RAM, 1GB disk space
- **Network:** Internet connection for installation and updates
:::
