Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install command in makefile

Tags:

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?

like image 667
namus Avatar asked May 24 '26 01:05

namus


1 Answers

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.

like image 58
prodev_paris Avatar answered May 25 '26 14:05

prodev_paris