How to install tar file (jhead) on Mac or Linux machine

82,257

Solution 1

Get the source

wget "http://www.sentex.net/~mwandel/jhead/jhead-2.97.tar.gz"

Untar the source

tar xzf jhead-2.97.tar.gz

Or, get and untar the source in one step

curl "http://www.sentex.net/~mwandel/jhead/jhead-2.97.tar.gz" | tar xz

Now you have a directory called jhead-2.97. Enter that directory and run make.

cd jhead-2.97
make

This will compile the code and link an executable for you called jhead.

Some makefiles have install targets. This one does. To install the executable,

make install

You'll probably need to run that as root. Now your program is installed and ready for use.


In this case, the install target looks like this:

cp jhead ${DESTDIR}/usr/local/bin/

If you ever run into a program without an install target in its makefile, just know that you have to get any executables into /usr/local/bin and any libraries into /usr/local/lib (or other appropriate locations.) Sometimes there are also other files you have to worry about such as documentation files (e.g. man pages), configuration files, etc.

Solution 2

Xcode 4.3 moved make to /Applications/Xcode.app/Contents/Developer/usr/bin/make. You can install make to /usr/bin/ by downloading the command line tools package from Xcode's preferences or from developer.apple.com/downloads (which requires a free developer account but not Xcode).

If make install results in an error like cp: directory /usr/local/bin does not exist, just run mkdir /usr/local/bin/.

You could also install Homebrew and run brew install jhead.

Solution 3

In 2021, homebrew doesn't recommend using the default /usr/local/bin for Apple Silicon or similar architecture. For M1 arm64 processors running (Big Sur, Monterey and later) homebrew recommends using /opt/homebrew/bin.

Brew recommendation for using /opt/homebrew can be found on the Homebrew installation page

Share:
82,257
Monte Carlo
Author by

Monte Carlo

Updated on September 18, 2022

Comments

  • Monte Carlo
    Monte Carlo over 1 year

    I'm new to Linux and tar balls and was wondering how to properly install them on a Mac or Linux machine. I would prefer to know how to install on a mac but I just need some help understanding them. I want to install jhead-2.97.tar.gz and I download the zipped source tar ball, yielding a folder containing a myriad of files. I know this is a silly question, but how do I properly install this file on my machine in the Terminal/LXTerminal?

    jhead is a command tool that is used to extract from an Exif jpeg file in the Terminal

  • Monte Carlo
    Monte Carlo about 11 years
    Is "make" a linux command, terminal says the command isn't found?
  • Christof
    Christof about 11 years
    make is packaged with most major Linux distributions. MacOS doesn't come with it; you'll have to install Xcode from the App Store to get it.
  • Christof
    Christof about 11 years
    Xcode provides an implementation of make. Try running /Applications/Install Xcode.app. See this.
  • Monte Carlo
    Monte Carlo about 11 years
    That got me half way there, I was able to run, but this only gave me this error when running "make instal" (also not quite sure what to do with"/Applications/Install Xcode.app") make install cp jhead /usr/local/bin/ cp: directory /usr/local/bin does not exist make: *** [install] Error 1
  • Christof
    Christof about 11 years
    What verson of MacOS are you using?
  • Monte Carlo
    Monte Carlo about 11 years
    2012 10.8.2 (Lion)
  • Monte Carlo
    Monte Carlo about 11 years
    When I run that line I get this prompt 'install cp jhead ${DESTDIR}/usr/local/bin/ usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 file2 install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 ... fileN directory install -d [-v] [-g group] [-m mode] [-o owner] directory ...'
  • Christof
    Christof about 11 years
    I believe you are supposed to copy the binary to /Applications, but I am not entirely sure. On most GNU/Linux machines, the appropriate location for the binary is /usr/local/bin or /usr/bin. MacOS has a different directory structure though.
  • Lri
    Lri about 11 years
    @EvanTeitelman /Applications/ is just used for application bundles. /usr/local/bin/ doesn't exist by default, but it is also used by homebrew, pip, and easy_install, and as a location for command line utilities installed by graphical applications.
  • Dhruv Ghulati
    Dhruv Ghulati almost 8 years
    How do you deal with adding to $PATH on the Mac? For example, I am using your method to install bazel (bazel.io/docs/install.html#mac-os-x) and it says as a final step: If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It's a good idea to add this directory to your default paths, as follows: $ export PATH="$PATH:$HOME/bin" You can also add this command to your ~/.bashrc file.