What a .tar.gz file is and why you need to extract it first
A .tar.gz file is a compressed folder that bundles source code or program files together. The ".tar" part means the files are collected into one archive, and the ".gz" part means that archive is compressed to save space — like a ZIP file, but more common on Linux and Mac systems. You cannot run or install the software directly from the compressed file. You have to extract it first, which unpacks all the files inside.
Most .tar.gz files contain source code that needs to be compiled — converted from human-readable instructions into a program your computer can actually run. Some contain pre-compiled binaries that are ready to use immediately after extraction. Either way, the first step is always the same: decompress and extract the archive.
Key Takeaways
- Extract the .tar.gz file using the command tar -xzf filename.tar.gz in your terminal, which unpacks all the files into a new folder.
- Read the README or INSTALL file inside the extracted folder first — it tells you exactly what dependencies you need and what commands to run next.
- Most source code requires you to run three commands in order: ./configure, make, and make install, but some projects use different build systems.
- If you get a "command not found" error, you are missing a required tool like a C compiler, and you will need to install it before continuing.
Extract the .tar.gz file using your terminal
Open your terminal application. On Mac, search for "Terminal" in Spotlight. On Linux, open your terminal from your applications menu or press Ctrl+Alt+T on most distributions.
Navigate to the folder where your .tar.gz file is located. If it is in your Downloads folder, type cd Downloads and press Enter. Then type tar -xzf filename.tar.gz, replacing "filename" with the actual name of your file. Press Enter. The command will run silently — if you see no error message, the extraction worked.
After extraction, a new folder with the same name (minus the .tar.gz part) will appear in that same directory. Type ls and press Enter to see the contents of the folder you are in. You should see the new extracted folder listed.
Navigate into the extracted folder and read the instructions
Type cd foldername, replacing "foldername" with the name of the folder that was just created. Press Enter. Now you are inside the extracted archive.
Type ls and press Enter to see what files are in this folder. Look for a file named README, INSTALL, or CONTRIBUTING — these are text files that explain how to build and install this particular software. Open one by typing cat README (or cat INSTALL) and pressing Enter. Read through the instructions. Different projects have different requirements, and this file will tell you what you need to do next.
Some projects use a standard build process, but others do not. The instructions in the README are always more reliable than a generic guide. If the README says to run a specific command, follow that instead of the steps below.
Run the configure script if one exists
Many projects include a file called configure that checks whether your system has all the tools needed to build the software. Type ./configure and press Enter. This script will run for a minute or two, checking for dependencies and creating a file called Makefile that contains the actual build instructions.
If you see an error message like "command not found" or "No such file or directory", the project may not use the configure system. Go back to the README — it will tell you what to do instead. Some projects use CMake, Meson, or other build systems that require different commands.
If configure runs successfully, you will see a summary at the end listing what features will be included. If something important is missing, the README will explain which package you need to install first. You may need to pause here, install a missing dependency on your system, and then run configure again.
Compile the source code with make
Type make and press Enter. This command reads the Makefile that configure created and compiles the source code into a working program. This step can take anywhere from a few seconds to several minutes, depending on the size of the project. You will see lines of text scrolling past — this is normal and means the compilation is working.
If the compilation fails and you see an error message, read it carefully. Common errors include missing dependencies (the error will name the missing library or tool) or an incompatible version of your compiler. The README usually lists what versions of tools are required. If you are stuck, copy the error message into a search engine along with the name of the project — someone has probably encountered the same problem.
Install the compiled program with make install
Type sudo make install and press Enter. The word sudo means "run this as an administrator" — most software installs to system folders that require administrator permission. You will be asked for your password. Type it (the characters will not appear on screen) and press Enter.
The installation will copy the compiled program and any supporting files to the correct locations on your system. This usually takes less than a minute. When it finishes, you should see a command prompt again with no error messages.
To verify the installation worked, type the name of the program and press Enter. For example, if you just installed a program called "myapp", type myapp and press Enter. If the program runs or shows a help message, the installation was successful. If you get "command not found", the program may have installed to a location your terminal does not know about — check the README for the full path to the executable.
Troubleshooting common installation problems
If you see "permission denied" when trying to extract the file, the file may not have read permissions. Type chmod +r filename.tar.gz and try extracting again. If you see "permission denied" during the make install step, make sure you used sudo before the command.
If you see "command not found" when running configure or make, your system is missing a required tool. On Ubuntu or Debian, type sudo apt update followed by sudo apt install build-essential to install the basic C compiler and related tools. On Mac, install Xcode Command Line Tools by typing xcode-select --install. On other systems, check your distribution's package manager documentation.
If the program installs but will not run, it may be looking for a library that is not installed. The error message will usually name the missing library. Search for that library name in your system's package manager and install it. Then try running the program again.
Frequently Asked Questions
Can I install a .tar.gz file without using the terminal?
On Mac, you can double-click a .tar.gz file and it will extract automatically. On Linux, most file managers have a right-click option to extract archives. However, if the software requires compilation, you will still need the terminal to run the configure, make, and make install commands. There is no graphical way around this step.
What if the README says to use cmake instead of configure?
CMake is a different build system. Instead of running ./configure, you would create a build folder, navigate into it, run cmake .., then make, then sudo make install. The README will give you the exact commands. Follow those instead of the standard three-step process.
Do I need to keep the extracted folder after installation?
Once installation is complete, you can delete the extracted folder and the original .tar.gz file. The installed program is now in your system folders and does not depend on the source files. However, keeping the folder does no harm if you want to refer back to the README later.
Why does make install need sudo but make does not?
The make command compiles code and creates files in the current folder, which you own. The make install command copies those files to system folders like /usr/local/bin, which require administrator permission to write to. That is why sudo is needed only for the install step.
What if I get an error about a missing library during compilation?
The error message will name the library. Search your system's package manager for that library name — usually with "-dev" at the end, like "libssl-dev". Install it, then run make clean to clear the failed build, and start over with ./configure.