# Installation Guide

This guide will help you install SQLife on your system.

## Download SQLife

### For End Users
Download the appropriate installer for your operating system from the [releases page](../../releases).

**Note:** SQLife is currently in active development. Check the releases page for the latest available version.

---

## Installation Steps

### Windows

1. **Download** the Windows installer (.msi) from the releases page
2. **Run** the installer by double-clicking the downloaded file
3. **Follow** the installation wizard
   - Accept the license agreement
   - Choose installation location (or use default)
   - Select Start Menu folder
4. **Launch** SQLife from:
   - Start Menu shortcut, or
   - Desktop shortcut (if selected during installation)

### macOS

1. **Download** the macOS package (.dmg) from the releases page
2. **Open** the .dmg file by double-clicking it
3. **Drag** the SQLife application icon to your Applications folder
4. **Launch** SQLife from the Applications folder

**First Launch Note:** macOS may ask you to confirm opening an application from an identified developer. Click "Open" to proceed.

### Linux

#### Using Package Manager (Recommended)

**Debian/Ubuntu (.deb):**
```bash
# Download the .deb package, then:
sudo dpkg -i sqlife_*.deb
```

**Fedora/RHEL (.rpm):**
```bash
# Download the .rpm package, then:
sudo rpm -i sqlife-*.rpm
```

After installation, launch SQLife from your application menu or by running `sqlife` in terminal.

---

## Running SQLife

### Windows
- Click the Start Menu shortcut, or
- Click the Desktop shortcut, or
- Navigate to installation folder and run `sqlife.exe`

### macOS
- Open from Applications folder, or
- Use Spotlight: Press Cmd+Space and type "SQLife"

### Linux
- Launch from application menu, or
- Run `sqlife` in terminal (if installed via package manager), or
- Run from installation directory: `./bin/sqlife`

---

## First-Time Setup

When you launch SQLife for the first time:

### 1. Application Data

SQLife creates a data folder in your home directory:
- **Windows:** `C:\Users\YourName\.sqlife\`
- **macOS:** `/Users/YourName/.sqlife/`
- **Linux:** `/home/yourname/.sqlife/`

This folder stores:
- Application settings
- Connection configurations
- SQL history
- Cache files
- Log files

**Note:** This folder is hidden by default. You typically don't need to access it directly.

### 2. License Activation

**For Trial Use:**
- SQLife starts in trial mode automatically
- Full features available for evaluation

**For Commercial Use:**
1. Go to **Help → License**
2. Click **Activate License**
3. Enter your license key
4. Click **Activate**

### 3. Choose Your Language

SQLife supports 13 languages. To change:

1. Open **Preferences**:
   - **Windows/Linux:** File → Preferences (or press Ctrl+,)
   - **macOS:** SQLife → Preferences (or press Cmd+,)
2. Select **General** section
3. Choose your language from the dropdown
4. Click **OK**
5. Restart SQLife

Available languages: English, 简体中文 (Simplified Chinese), 繁體中文 (Traditional Chinese), 日本語 (Japanese), 한국어 (Korean), Français (French), Deutsch (German), Español (Spanish), Italiano (Italian), Русский (Russian), Türkçe (Turkish), العربية (Arabic), Português (Portuguese)

### 4. Create Your First Connection

See the [Getting Started Guide](03-getting-started.md) for instructions on connecting to your database.

---

## Troubleshooting

### Installation Won't Start

**Problem:** Installer doesn't run or shows an error.

**Windows:**
- Right-click the installer and select "Run as Administrator"
- Check Windows Defender isn't blocking the installer
- Verify you downloaded the correct version (64-bit)

**macOS:**
- Go to System Preferences → Security & Privacy
- Click "Open Anyway" if SQLife is blocked
- Or: Right-click SQLife in Applications and select "Open"

**Linux:**
- Verify the package matches your distribution
- Check file permissions: `chmod +x sqlife-*.run` (if applicable)
- Install required dependencies for your distribution

### Application Won't Launch

**Problem:** SQLife doesn't start after installation.

**Solutions:**
1. **Restart your computer** - Sometimes required after first install
2. **Check system requirements** - Verify your OS version is supported
3. **Check logs** - Look in `~/.sqlife/logs/` for error messages
4. **Reinstall** - Uninstall completely and reinstall

### "Access Denied" or Permission Errors

**Windows:**
- Run SQLife as Administrator (right-click → Run as Administrator)
- Install to a location where you have write permissions

**macOS/Linux:**
- Check ownership: `ls -la ~/.sqlife/`
- Fix permissions if needed: `chmod -R u+w ~/.sqlife/`

### Application Crashes on Startup

**Problem:** SQLife starts then immediately closes.

**Solutions:**
1. Delete cache and state:
   - Close SQLife
   - Delete `~/.sqlife/cache/` and `~/.sqlife/state/`
   - Restart SQLife
2. Check display settings - ensure your monitor resolution is at least 1280x800
3. Update graphics drivers
4. Check logs in `~/.sqlife/logs/application.log`

### macOS: "App is damaged and can't be opened"

**Solution:**
```bash
# Remove quarantine attribute
xattr -d com.apple.quarantine /Applications/SQLife.app
```

Or allow in: System Preferences → Security & Privacy → General → "Open Anyway"

### Slow Performance

**Solutions:**
- Close other applications to free up memory
- Increase available RAM (close browser tabs, etc.)
- Clear SQLife cache: Delete `~/.sqlife/cache/`
- Check your database server performance

### Can't Find Installation Directory

**Default Locations:**
- **Windows:** `C:\Program Files\SQLife\`
- **macOS:** `/Applications/SQLife.app`
- **Linux (package):** `/opt/sqlife/` or `/usr/local/sqlife/`
- **Linux (manual):** Wherever you extracted it

---

## Uninstalling SQLife

### Windows
1. Open **Settings** → **Apps** → **Apps & features**
2. Find **SQLife** in the list
3. Click **Uninstall**
4. Follow the uninstall wizard

Or use: Control Panel → Programs → Uninstall a program

### macOS
1. Open **Applications** folder
2. Drag **SQLife** to Trash
3. Empty Trash

To remove user data:
```bash
rm -rf ~/.sqlife
```

### Linux

**Package Manager:**
```bash
# Debian/Ubuntu
sudo apt remove sqlife

# Fedora/RHEL
sudo rpm -e sqlife
```

**Manual Installation:**
```bash
# Remove installation directory
sudo rm -rf /opt/sqlife

# Remove user data (optional)
rm -rf ~/.sqlife
```

---

## Getting Help

If you encounter issues not covered here:

1. **Check the FAQ** - [FAQ Document](https://bitifyware.com/sqlife/help) has solutions to common problems
2. **Check Logs** - Look in `~/.sqlife/logs/` for error details
4. **Contact Support** - For licensed users, contact technical support

---

## Next Steps

After successful installation:
- **Start Using SQLife:** [Getting Started Guide](03-getting-started.md)
- **First Connection:** Learn how to connect to your database
- **Explore Features:** Browse the complete user guide

For questions, check the [FAQ](../faq.md).
