How to Install a .tar.gz File on Linux and macOS

If you've downloaded software from a developer's website and ended up with a file ending in .tar.gz, you're looking at a compressed archive — the Unix equivalent of a ZIP file, but with a few extra steps before the software is ready to run. Understanding what those steps actually do makes the difference between a smooth install and a frustrating guessing game.

What Is a .tar.gz File?

A .tar.gz file is two things stacked together. TAR (Tape Archive) bundles multiple files and directories into a single file without compressing them. GZ (Gzip) then compresses that bundle to reduce file size. Together, they're the standard way open-source developers distribute source code and pre-compiled binaries on Linux and macOS.

There are two types of .tar.gz packages you'll encounter, and the install process is meaningfully different for each:

  • Pre-compiled binaries — ready to run after extraction, no building required
  • Source code — requires compiling before you have a working program

Knowing which type you have before you start saves a lot of time.

Step 1: Extract the Archive

Open a terminal and navigate to the directory where the file was downloaded. The standard extraction command works on both Linux and macOS: