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

# Installation

> Install Shed Skin and its dependencies on Linux, macOS, or Windows

Shed Skin requires Python and several system libraries to compile and run generated programs. This guide covers installation on all major platforms.

## Choose your platform

<CardGroup cols={3}>
  <Card title="Linux" icon="linux" href="#linux">
    Ubuntu, Debian, Fedora, and other distributions
  </Card>

  <Card title="macOS" icon="apple" href="#macos">
    Install via Homebrew or build from source
  </Card>

  <Card title="Windows" icon="windows" href="#windows">
    Using Visual Studio Build Tools
  </Card>
</CardGroup>

## Linux

<Steps>
  <Step title="Install from distribution (recommended)">
    On Ubuntu/Debian, install Shed Skin directly from the package manager:

    ```bash theme={null}
    sudo apt-get install shedskin
    ```

    This installs Shed Skin and most dependencies automatically.
  </Step>

  <Step title="Install dependencies">
    To compile and run programs generated by Shed Skin, you need:

    * **g++** - The GNU C++ compiler
    * **libpcre2-dev** - PCRE2 library for regular expressions
    * **python-all-dev** - Python development headers
    * **libgc-dev** - Boehm garbage collector

    Install all dependencies at once:

    ```bash Ubuntu/Debian theme={null}
    sudo apt-get install g++ libpcre2-dev python-all-dev libgc-dev
    ```

    ```bash Fedora theme={null}
    sudo dnf install gcc-c++ pcre2-devel python-devel gc-devel
    ```

    <Note>
      The package names may vary slightly between distributions. Use your distribution's package search to find the correct names.
    </Note>
  </Step>

  <Step title="Install from source (alternative)">
    If Shed Skin isn't available in your package manager, install from source:

    ```bash theme={null}
    # Install pip if not already installed
    sudo apt-get install python3-pip

    # Install Shed Skin
    pip install shedskin
    ```

    Or download and install from the tarball:

    ```bash theme={null}
    # Download tarball from GitHub releases
    wget https://github.com/shedskin/shedskin/archive/refs/tags/latest.tar.gz
    tar -xzf latest.tar.gz
    cd shedskin-*
    sudo python setup.py install
    ```
  </Step>

  <Step title="Verify installation">
    Check that Shed Skin is installed correctly:

    ```bash theme={null}
    shedskin --help
    ```

    You should see the Shed Skin command-line help.
  </Step>
</Steps>

### Building dependencies from source

If the required libraries aren't available via your package manager, you can build them from source.

<AccordionGroup>
  <Accordion title="Build Boehm GC from source">
    Download version 7.2alpha6 or later from [hboehm.info/gc](https://www.hboehm.info/gc/):

    ```bash theme={null}
    wget https://www.hboehm.info/gc/gc_source/gc-7.2alpha6.tar.gz
    tar -xzf gc-7.2alpha6.tar.gz
    cd gc-7.2alpha6

    ./configure --prefix=/usr/local \
      --enable-threads=posix \
      --enable-cplusplus \
      --enable-thread-local-alloc \
      --enable-large-config

    make
    make check
    sudo make install
    ```

    The configuration flags enable important features:

    * `--enable-threads=posix` - Thread support
    * `--enable-cplusplus` - C++ bindings
    * `--enable-thread-local-alloc` - Thread-local allocation for performance
    * `--enable-large-config` - Support for large heaps
  </Accordion>

  <Accordion title="Build PCRE2 from source">
    Download version 10.44 or later from [pcre.org](http://www.pcre.org/):

    ```bash theme={null}
    wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.gz
    tar -xzf pcre2-10.44.tar.gz
    cd pcre2-10.44

    ./configure --prefix=/usr/local
    make
    sudo make install
    ```
  </Accordion>
</AccordionGroup>

## macOS

<Steps>
  <Step title="Install Xcode Command Line Tools">
    First, ensure you have the Xcode Command Line Tools (includes the C++ compiler):

    ```bash theme={null}
    xcode-select --install
    ```
  </Step>

  <Step title="Install dependencies with Homebrew">
    Use [Homebrew](https://brew.sh/) to install the required libraries:

    ```bash theme={null}
    # Install Homebrew if not already installed
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    # Install dependencies
    brew install bdw-gc pcre2 python
    ```

    <Note>
      `bdw-gc` is the Boehm garbage collector package on Homebrew.
    </Note>
  </Step>

  <Step title="Install Shed Skin">
    Install Shed Skin using pip:

    ```bash theme={null}
    pip3 install shedskin
    ```

    Or from the tarball:

    ```bash theme={null}
    # Download from GitHub
    curl -L -O https://github.com/shedskin/shedskin/archive/refs/tags/latest.tar.gz
    tar -xzf latest.tar.gz
    cd shedskin-*
    sudo python3 setup.py install
    ```
  </Step>

  <Step title="Verify installation">
    Confirm Shed Skin is working:

    ```bash theme={null}
    shedskin --help
    ```
  </Step>
</Steps>

<Accordion title="Building dependencies from source on macOS">
  If you prefer to build from source rather than using Homebrew, follow the same instructions as Linux:

  **Boehm GC:**

  ```bash theme={null}
  ./configure --prefix=/usr/local \
    --enable-threads=posix \
    --enable-cplusplus \
    --enable-thread-local-alloc \
    --enable-large-config
  make
  make check
  sudo make install
  ```

  **PCRE2:**

  ```bash theme={null}
  ./configure --prefix=/usr/local
  make
  sudo make install
  ```
</Accordion>

## Windows

Windows installation requires Visual Studio Build Tools and uses CMake with Conan for dependency management.

<Steps>
  <Step title="Install Visual Studio Build Tools">
    Download and install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022).

    During installation, make sure to enable:

    * **Desktop development with C++**
    * **CMake tools for Windows** (under Individual Components)

    <Warning>
      You need the full Build Tools with C++ support, not just the basic tools.
    </Warning>
  </Step>

  <Step title="Install CMake">
    Download and install [CMake](https://cmake.org/download/) (3.15 or later).

    During installation, choose to add CMake to your system PATH.
  </Step>

  <Step title="Install Conan">
    Install Conan 1.62.0 using pip:

    ```bash theme={null}
    pip install "conan==1.62.0"
    ```

    <Note>
      Shed Skin currently requires Conan 1.x, not Conan 2.x.
    </Note>
  </Step>

  <Step title="Install Shed Skin">
    Install Shed Skin using pip:

    ```bash theme={null}
    pip install shedskin
    ```
  </Step>

  <Step title="Verify installation">
    Open a "Visual Studio Developer Command Prompt" (not regular Command Prompt) and run:

    ```bash theme={null}
    shedskin --help
    ```

    <Tip>
      Always use the Visual Studio Developer Command Prompt when working with Shed Skin on Windows, as it sets up the compiler environment.
    </Tip>
  </Step>
</Steps>

### Windows-specific notes

<AccordionGroup>
  <Accordion title="Why use --conan flag?">
    On Windows, use the `--conan` flag when building:

    ```bash theme={null}
    shedskin build --conan test
    ```

    This tells Shed Skin to use Conan to automatically download and build dependencies (Boehm GC and PCRE2). Without this flag, you'd need to manually install these libraries.
  </Accordion>

  <Accordion title="Executable location">
    On Windows, compiled programs are placed in `build/Debug/` or `build/Release/` instead of just `build/`:

    ```bash theme={null}
    # Debug build (default)
    build\Debug\test.exe

    # Release build
    shedskin build --build-type Release test
    build\Release\test.exe
    ```
  </Accordion>

  <Accordion title="nmake not found error">
    If you see "nmake is not recognized", you're not in a Developer Command Prompt. Open the Start menu and search for "Developer Command Prompt for VS".
  </Accordion>
</AccordionGroup>

## Verify your installation

Test your installation with a simple program:

<Steps>
  <Step title="Create test.py">
    ```python test.py theme={null}
    print('hello, world!')
    ```
  </Step>

  <Step title="Compile it">
    <CodeGroup>
      ```bash Linux/macOS theme={null}
      shedskin build test
      ```

      ```bash Windows theme={null}
      shedskin build --conan test
      ```
    </CodeGroup>
  </Step>

  <Step title="Run it">
    <CodeGroup>
      ```bash Linux/macOS theme={null}
      build/test
      ```

      ```bash Windows theme={null}
      build\Debug\test.exe
      ```
    </CodeGroup>

    If you see `hello, world!`, your installation is working correctly!
  </Step>
</Steps>

## Distributing compiled programs

When distributing compiled programs to other systems, include the required runtime libraries.

### Linux/macOS

Your binary depends on `libgc` and `libpcre2-8`. To check dependencies:

```bash theme={null}
ldd build/test
```

You'll see something like:

```
libgc.so.1 => /usr/lib/libgc.so.1
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0
```

If these libraries aren't available on the target system, copy them alongside your binary:

```bash theme={null}
# Copy libraries
cp /usr/lib/libgc.so.1 build/
cp /lib/x86_64-linux-gnu/libpcre2-8.so.0 build/

# Run with library path
LD_LIBRARY_PATH=build ./build/test
```

<Warning>
  Both systems must be 32-bit or both 64-bit for this to work.
</Warning>

### Windows

Windows executables built with `--conan` are statically linked and should run without additional dependencies.

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Compile your first program
  </Card>

  <Card title="Command-line options" icon="terminal" href="/cli/options">
    Learn about build flags and options
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/resources/troubleshooting">
    Solve common installation issues
  </Card>

  <Card title="Examples" icon="code" href="/examples/overview">
    Browse example programs
  </Card>
</CardGroup>

## Getting help

If you encounter issues:

* Check the [troubleshooting guide](/resources/troubleshooting)
* Visit the [GitHub issues](https://github.com/shedskin/shedskin/issues)
* Join the mailing list for community support
