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

# Installation

> Install TinyCC on Linux, BSD, macOS, or Windows

# Installation

TinyCC is designed to be easy to build and install on all major platforms. Follow the instructions for your operating system below.

## Linux and macOS

**1. Download the source**

Clone the TinyCC repository or download the latest release tarball:

```bash theme={null}
git clone git://repo.or.cz/tinycc.git
cd tinycc
```

**2. Configure the build**

Run the configure script to detect your system and set up the build:

```bash theme={null}
./configure
```

> [!TIP]
>
> Run `./configure --help` to see available configuration options, such as custom installation paths or cross-compilation settings.

Common configuration options:

```bash theme={null}
# Install to a custom location
./configure --prefix=/opt/tcc

# Enable cross-compilation support
./configure --enable-cross

# Disable documentation generation
./configure --disable-doc
```

**3. Build TinyCC**

Compile the TCC binary:

```bash theme={null}
make
```

This typically takes just a few seconds on modern hardware.

**4. Run tests (optional)**

Verify that TCC works correctly on your system:

```bash theme={null}
make test
```

The test suite runs various C programs through TCC to ensure correctness.

**5. Install TinyCC**

Install TCC to your system (requires root/sudo):

```bash theme={null}
make install
```

By default, TCC installs to `/usr/local/bin`. The installation includes:

* `tcc` binary in `/usr/local/bin`
* TCC libraries in `/usr/local/lib/tcc`
* Include files in `/usr/local/lib/tcc/include`

**6. Verify installation**

Check that TCC is installed and working:

```bash theme={null}
tcc -v
```

This should display the TCC version information.

> [!NOTE]
>
> The `makeinfo` tool must be installed to compile the documentation. If you don't need the documentation, you can skip this requirement or disable it with `./configure --disable-doc`.

## BSD systems

On BSD variants (FreeBSD, OpenBSD, NetBSD), the installation process is nearly identical to Linux, with one important difference:

> [!WARNING]
>
> Use `gmake` (GNU Make) instead of `make` on BSD systems.

**1. Install GNU Make**

If `gmake` is not already installed:

```bash FreeBSD theme={null}
pkg install gmake
```

```bash OpenBSD theme={null}
pkg_add gmake
```

```bash NetBSD theme={null}
pkgin install gmake
```

**2. Build and install**

Follow the same steps as Linux, but use `gmake` instead of `make`:

```bash theme={null}
./configure
gmake
gmake test
gmake install
```

## Windows

For Windows installation, TinyCC provides native Win32 support.

**1. Download Windows binary**

The easiest way to get TCC on Windows is to download a pre-built binary from the official release page.

Alternatively, you can build from source using MinGW or MSYS2.

**2. Extract the archive**

Extract the TCC archive to a directory, such as `C:\tcc`.

**3. Add to PATH**

Add the TCC directory to your system PATH environment variable to run `tcc` from anywhere.

**4. Verify installation**

Open Command Prompt and verify TCC is working:

```cmd theme={null}
tcc -v
```

> [!NOTE]
>
> For detailed Windows-specific information, including building from source on Windows, refer to `tcc-win32.txt` in the TCC source distribution.

## Configuration options

The `./configure` script accepts several options to customize your installation:

| Option | Description |
| - | - |
| `--prefix=DIR` | Install TCC to directory DIR (default: `/usr/local`) |
| `--bindir=DIR` | Install binaries to DIR (default: `PREFIX/bin`) |
| `--libdir=DIR` | Install libraries to DIR (default: `PREFIX/lib`) |
| `--includedir=DIR` | Install includes to DIR (default: `PREFIX/include`) |
| `--enable-cross` | Build cross-compilers for all supported architectures |
| `--disable-static` | Don't build static library |
| `--config-predefs=yes` | Force use of system predefined macros |
| `--cpu=x86_64` | Explicitly set target CPU architecture |

> [!TIP]
>
> For cross-compilation support (building code for different architectures), use `--enable-cross` during configuration. This allows you to compile ARM code on x86\_64, for example.

## System requirements

### Build dependencies

* C compiler (GCC, Clang, or another C compiler to bootstrap TCC)
* GNU Make (or `gmake` on BSD)
* Standard development tools (`ar`, `sed`, etc.)
* Optional: `makeinfo` for building documentation

### Runtime dependencies

TCC has minimal runtime dependencies:

* Standard C library (glibc, musl, or system libc)
* Dynamic linker (for shared library support)

> [!NOTE]
>
> Once built, TCC itself is self-contained and doesn't require GCC or any other compiler to be installed for using it.

## Troubleshooting

> **configure: command not found**
>
> Make sure you've downloaded the source code and are in the correct directory. The configure script should be in the root of the TCC source tree.

> **make: command not found on BSD**
>
> Use `gmake` instead of `make` on BSD systems. Install GNU Make if it's not already available.

> **Permission denied during make install**
>
> You need root privileges to install to system directories. Use `sudo make install` or configure with a different `--prefix` that you have write access to.

> **Test failures**
>
> Some tests may fail on certain systems or configurations. If only a few tests fail and TCC works for basic programs, this is usually acceptable for personal use. Check the TCC mailing list or issue tracker for known issues.

## Next steps

> **[Quick start guide](https://mintlify.com/TinyCC/tinycc/quickstart.md)**
>
> Now that TCC is installed, try compiling your first program


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