1. Does make install with a Makefile most of the time call /usr/bin/install?

  2. What necessary work does /usr/bin/install do besides copying the just compiled files to /usr/bin/local?

  3. The man page says /usr/bin/install copy files and set attributes. What attributes are so important to set?

  4. Does it just set permission modes and owner/group, which are not necessary?
  • "Does make install with a Makefile most of the time call /usr/bin/install?" No, it does whatever it wants. It is a make target. Is your question about the install executable? Or about make? It is not clear. Commented Jul 9, 2014 at 16:43
  • both. @FaheemMitha
    – Tim
    Commented Jul 9, 2014 at 16:46
  • Ok, well, 1 and 2 are different questions, and the answer to 1 is, probably not, but define "most of the time". I'm not sure of the point of 1, anyway. Commented Jul 9, 2014 at 16:50

2 Answers 2


install offers a number of features in addition to copying files to a directory.

  • the -s option removes the symbol table from an executable, saving space
  • the -m option sets the permission bits. The files sitting in the developer's directory were created subject to his or her umask, which may prevent others from executing them. install -m 755 file1 /usr/local/bin ensures that everyone can execute the file, which is likely what the developer wants for a file in a shared directory.
  • the -o and -g options set the owner and group. With cp, the owner and group of the destination file would be set to the uid and gid of whoever ran the cp, and with cp -p, the owner and group of the destination file would be the same as the file in the build directory, neither of which might be what the developer wants. The wall program needs to be in group tty, the screen program needs to be group utmp, etc.
  • it reduces the number of commands that need to be put in a makefile recipe. install -s -m 755 -o root -g bin file1 file2 lib/* $(DESTDIR) is more succinct than the four commands cp, strip, chmod, and chown.

The last bullet point is likely why the install command was invented and why many makefiles use it.

Install isn't always used, though. I've seen cp -r lib $(DESTDIR)/lib when there's a whole tree full of stuff to copy, and ./install.sh if the developer prefers to use a custom script. Many packages have a install.sh derived from the one that comes with X11, which is like install but supports a -t (transform) option to rename the destination files in a specified way.

  1. Since what commands are used in a makefile is essentially up to the project developers, it is difficult to give a definite answer here. Generally I would say that it is good practice to use the install command in a makefile for any installation processes mentioned in 2, but then again install is not POSIX so always using it may not be the most portable approach

    AFAIK most of the tools can be used to automatically generate makefiles like automake and cmake will use install.

  2. Generally install is used for copying files and setting permissions/owner/group in one command like you say. One other commonly used function is to strip unnecessary symbols (eg debugging symbols) from a binary that no longer needs them. It also has a few extra options for things like making backups before installing and working within an SELinux context which may be useful.

Which permissions to choose depend on the file itself. Mostly installed files are readable by everyone, but only writeable by root (the idea is to put program files in a place where it is accessible by everyone but cannot be tampered with). This is not the case with everything, if the file contains sensitive data then it is common to limit access to a group or to root only.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .