namus
namus

Reputation: 79

install command in makefile

Iam getting some error while installing executable in /usr/local/bin thru makefile:

install -m 755 my_execble /usr/local/bin

install: cannot create regular file /usr/local/bin/my_execble: Permission denied

If use sudo before 'install' command .. then it will work .. but is there other way of installing without using sudo?

Upvotes: 3

Views: 8505

Answers (2)

prodev_paris
prodev_paris

Reputation: 515

The OP ask long time ago, but I will guess it can be useful for others.

Since your make install command try to install files in directory requiring root privileges (ex: /usr/local/bin) you can either:

  • Become root before launching your command (as you stated in your description: using sudo for example)

OR

  • Install it in another directory that do not require specific privilege. For this purpose you can use a specific parameter named 'DESTDIR' that is usually supported in makefile, so that your command looks like:

    make DESTDIR=/home/myuser/my_dest_dir install

    This is named Staged Installs.

Upvotes: 6

Edgar Bonet
Edgar Bonet

Reputation: 3566

You can either tweak the Makefile (or use a configure script) to have it install the program in your home directory... or become root.

Upvotes: 0

Related Questions