I'm trying to edit a Makefile that contains:

install -d $(DESTDIR)/usr/lib/myApp
install -d $(DESTDIR)/usr/lib/myApp/scripts
install -t $(DESTDIR)/usr/lib/myApp/scripts \
    src/scripts/ap.sh \
    src/scripts/connect.sh \
    src/scripts/devices.sh \
    src/scripts/create_ap \

After reading this Q/A, I got the idea that I could replace all that with:

install -D src/scripts/* $(DESTDIR)/usr/lib/myApp/scripts

But the above gives me an error saying:

install: target '/var/lib/jenkins/data/workspace/network-service_build-test@2/build/debian/myApp-service-network/usr/lib/myApp/scripts/network' is not a directory

Am I misunderstanding the use of the -D flag here? I'm thinking it should move my files to the path specified and create the folders if needed.

1 Answer 1


I believe that you need

install -t "$(DESTDIR)/usr/lib/myApp/scripts/network" -D src/scripts/*

This will create $(DESTDIR)/usr/lib/myApp/scripts/network (including intermediate directories) and copy the files src/scripts/* there.

Testing (with extra verbosity turned on):

$ touch file-{1,2,3,4}
$ install -v -t test/dir -D file-[1-4]
install: creating directory 'test'
install: creating directory 'test/dir'
'file-1' -> 'test/dir/file-1'
'file-2' -> 'test/dir/file-2'
'file-3' -> 'test/dir/file-3'
'file-4' -> 'test/dir/file-4'

This works with GNU install from coreutils 8.25, but fails with coreutils 8.4. For older coreutils implementations, do it in two steps:

install -d "$(DESTDIR)/usr/lib/myApp/scripts/network"
install -t "$(DESTDIR)/usr/lib/myApp/scripts/network" src/scripts/*

... or something similar.

  • Didn't mean to include the network change in the question, that was another change I was making (will remove). I'm still getting the same error with this command for some reason pastebin.com/UCr8L9Bm Nov 2, 2017 at 20:48
  • Yet if I run install -d $(DESTDIR)/usr/lib/myApp/scripts/network before the command you posted it seems to work fine. It must be something unique to our build system? Nov 2, 2017 at 20:58
  • 1
    @PhilipKirkbride I can reproduce your problem with an older version of install. I'm using GNU install from coreutils 8.25 (which works), and my failing install is on coreutils 8.4. Either upgrade your coreutils, or do it in two steps.
    – Kusalananda
    Nov 2, 2017 at 21:01

You must log in to answer this question.

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