I'm just trying to delete a non empty folder (and sub contents) with the terminal on mac (folder is a non system folder, just a random testing folder placed on user desktop):

rm -r foldername

It returns:

rm: illegal option -- - usage: rm [-f | -i] [-dPRrvW] file ...

unlink file

Does anyone know the right way to go about this ?

1 Answer 1


type -a rm

returns :

rm is aliased to `rm --preserve-root'
rm is /bin/rm

--preserve-root is NOT supported on mac terminal.

  • --preserve-root is a GNU extension to the rm command, but macOS uses mostly BSD versions of command-line programs (including rm), so it doesn't support that. If you try to bring things directly over from linux to macOS, there are a lot of such differences you may run into. Also, don't consult the linux man pages when using macOS -- either use the man command directly, or use an online copy of the macOS man pages. Apr 28, 2018 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.