Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a makefile which installs a lot of files in my target build directory. Some of these are executable, some are not.

I tested the install command with flags -D -m 644 for non-executable files earlier with Linux, but now it broke. I have discovered that -D flag is not available with OSX/BSD, and have removed it. The thing is, I need to make sure that the component directories in the paths of files I am installing are created as necessary. I thought the -d flag will help, but doing something like:

install .DS_Store ./tmp/build/some_dir/

But it complains that the some_dir is "no such file or directory", i.e. it does not exist (which is true). I then tried the same as above but with the -d flag, and got another error:

install: .DS_Store exists but is not a directory

I just want a more or less stable and generic way to copy files to destination. Maybe I should resort to cp? I know the minor but important differences between the two, though.

share|improve this question
up vote 2 down vote accepted

install -d interprets all of its arguments as directories that (might) need to be created. Thus, I think you need to do it as two commands:

install -d ./tmp/build/some_dir/
install .DS_Store ./tmp/build/some_dir/
share|improve this answer

You must log in to answer this question.

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