MacOS – What happens if you used “rm -rf *” in /Users or /Users/someUser

command linedeletingmacospermission

Note: Don't type rm or any variation of it into terminal under any circumstances if you are not experienced with the command line

Does the Mac OS X block you from using rm in those directories to delete a user or delete all the users and do you need to use sudo and put in an administrator password or does it let you without any passwords?

For example if you typed in the following line into terminal would it just completely wipe everything?

cd /Users; echo rm -rf *

Of course the echo wouldn't be used if you actually wanted the remove command to run.

Best Answer

Two cases:

  • you're logged in as root. Everything goes away.
  • you're logged in as a normal user. All of that user's files go away.

In some systems, rm is supposed to prompt you if you do this at the "/" level. Do not count on that prompt.

With El Capitan, Apple supplies a "prompt" per se, which by default should leave enough of the operating system to boot and recover from your backups. To see if this has not been disabled, use

csrutil status

Further reading: