Could anybody explain is there any difference between cp some-file.txt some-folder and cp -rf some-file.txt some-folder on a Mac?

I was told that cp -rf forces cp to overwrite existing files, but it seems it overwrite them even without -rf.

So what is the reason to use -rf here then?

  • Some cases, not sure about macOS, alias commands to cp -i in some cases (e.g. RHEL as root) and the -f then overrides the -i from the alias... (Not an answer since it is probably not the case on macOS, but might explain some advice on the internet) Feb 23 at 14:46

1 Answer 1


The standard cp binary on macOS doesn't have a -r option. If you want to copy directories, you need -R. Maybe the person telling you this was confusing it with rm -rf.

As for -f, the man page says

If the destination file cannot be opened, remove it and create a new file, 
without prompting for confirmation regardless of its permissions.

So, in case the destination file exists but you don't have write access, cp usually would fail. -f tries to remove the file (which is possible as long as you have write access to the directory) and then replaces it with the copied version.

$ touch foo bar
$ chmod -w bar
$ cp foo bar
cp: bar: Permission denied
$ cp -f foo bar

You must log in to answer this question.

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