> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Install ClickHouse on MacOS

# Install ClickHouse using tgz archives

# Install ClickHouse using tgz archives

> It is recommended to use official pre-compiled `tgz` archives for all Linux distributions, where installation of `deb` or `rpm` packages isn't possible.

<Steps>
  <Step>
    <h2 id="review-recommendations">
      Review recommendations
    </h2>

    Before installing ClickHouse, review the following recommendations:

    * **Swap:** Disable the operating system's swap file in production environments.
    * **Disk space:** The ClickHouse binary requires at least 2.5 GB of disk space for installation.
    * **Network:** For distributed deployments (clustering), use at least 10 Gbit network connectivity. Network bandwidth is critical for processing distributed queries with large amounts of intermediate data, as well as for replication.

    **Estimating storage requirements**

    To estimate the disk space needed for your data:

    1. **Estimate data volume:** Take a sample of your data and calculate the average row size, then multiply by the number of rows you plan to store.
    2. **Apply the compression coefficient:** Load a sample into ClickHouse and compare the original data size with the stored table size. Clickstream data, for example, is typically compressed 6-10x.
    3. **Account for replicas:** If you plan to store data in multiple replicas, multiply the estimated volume by the number of replicas.

    For more detailed hardware requirements, see ["Sizing and hardware recommendations"](/guides/oss/best-practices/sizing-and-hardware-recommendations)
  </Step>

  <Step>
    <h2 id="install-latest-stable">
      Download and install the latest stable version
    </h2>

    The required version can be downloaded with `curl` or `wget` from repository [https://packages.clickhouse.com/tgz/](https://packages.clickhouse.com/tgz/).
    After that downloaded archives should be unpacked and installed with installation scripts.

    Below is an example of how to install the latest stable version.

    <Note>
      For production environments, it's recommended to use the latest `stable`-version.
      You can find the release number on this [GitHub page](https://github.com/ClickHouse/ClickHouse/tags)
      with postfix `-stable`.
    </Note>
  </Step>

  <Step>
    <h2 id="get-latest-version">
      Get the latest ClickHouse version
    </h2>

    Get the latest ClickHouse version from GitHub and store it in `LATEST_VERSION` variable.

    ```bash theme={null}
    LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/utils/list-versions/version_date.tsv | \
        grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | sort -V -r | head -n 1)
    export LATEST_VERSION
    ```
  </Step>

  <Step>
    <h2 id="detect-system-architecture">
      Detect your system architecture
    </h2>

    Detect the system architecture and set the ARCH variable accordingly:

    ```bash theme={null}
    case $(uname -m) in
      x86_64) ARCH=amd64 ;;         # For Intel/AMD 64-bit processors
      aarch64) ARCH=arm64 ;;        # For ARM 64-bit processors
      *) echo "Unknown architecture $(uname -m)"; exit 1 ;; # Exit if architecture isn't supported
    esac
    ```
  </Step>

  <Step>
    <h2 id="download-tarballs">
      Download tarballs for each ClickHouse component
    </h2>

    Download tarballs for each ClickHouse component. The loop tries architecture-specific
    packages first, then falls back to generic ones.

    ```bash theme={null}
    for PKG in clickhouse-common-static clickhouse-common-static-dbg clickhouse-server clickhouse-client clickhouse-keeper
    do
      curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION-${ARCH}.tgz" \
        || curl -fO "https://packages.clickhouse.com/tgz/stable/$PKG-$LATEST_VERSION.tgz"
    done
    ```
  </Step>

  <Step>
    <h2 id="extract-and-install">
      Extract and install packages
    </h2>

    Run the commands below to extract and install the following packages:

    * `clickhouse-common-static`

    ```bash theme={null}
    # Extract and install clickhouse-common-static package
    tar -xzvf "clickhouse-common-static-$LATEST_VERSION-${ARCH}.tgz" \
      || tar -xzvf "clickhouse-common-static-$LATEST_VERSION.tgz"
    sudo "clickhouse-common-static-$LATEST_VERSION/install/doinst.sh"
    ```

    * `clickhouse-common-static-dbg`

    ```bash theme={null}
    # Extract and install debug symbols package
    tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION-${ARCH}.tgz" \
      || tar -xzvf "clickhouse-common-static-dbg-$LATEST_VERSION.tgz"
    sudo "clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh"
    ```

    * `clickhouse-server`

    ```bash theme={null}
    # Extract and install server package with configuration
    tar -xzvf "clickhouse-server-$LATEST_VERSION-${ARCH}.tgz" \
      || tar -xzvf "clickhouse-server-$LATEST_VERSION.tgz"
    sudo "clickhouse-server-$LATEST_VERSION/install/doinst.sh" configure
    sudo /etc/init.d/clickhouse-server start  # Start the server
    ```

    * `clickhouse-client`

    ```bash theme={null}
    # Extract and install client package
    tar -xzvf "clickhouse-client-$LATEST_VERSION-${ARCH}.tgz" \
      || tar -xzvf "clickhouse-client-$LATEST_VERSION.tgz"
    sudo "clickhouse-client-$LATEST_VERSION/install/doinst.sh"
    ```
  </Step>
</Steps>
