Installing from TAR Files
Package managers like Homebrew are not the only means for installing software on the command line. Much free software is distributed in compressed TAR files, which we first encountered in File Compression and Packaging. You can work with these files manually to unpack, build, and install programs without a package manager. However, you’ll need to deal yourself with dependencies between programs, difficult uninstalls, and a host of other issues that package managers handle automatically. (In fact, Homebrew uses compressed TAR files behind the scenes.) Let’s examine how to work with these files.
Packaged software files with names ending in .tar.gz and .tar.bz2 typically contain source code written in a programming language.[32] Before installing the software, you’ll need to compile (build) it. Typical build instructions are:
List the package contents, one file per line. Assure yourself that each file, when extracted, won’t overwrite something precious on your system, either accidentally or maliciously:[33]
➜
tar tvzfFor gzip files ➜package.tar.gz | lesstar tvjfFor bzip2 filespackage.tar.bz2 | lessIf satisfied, extract the files into a new directory. Run these commands as yourself, not as root, for safety reasons:
➜
mkdir newdir➜cd newdir➜tar xvzfFor gzip files ➜<path>/package.tar.gztar xvjfFor bzip2 files<path>/package.tar.bz2Look for an extracted file named INSTALL or README. Read it to learn how to build the software, for example:
➜
cd newdir
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access