

But why bother using this command line tool to delete things? There are some common reasons for explaining why people choose to delete a file in Terminal, remove folder Terminal, or delete a directory in Terminal. That means you’re not able to get them back from Mac as you usually do. However, if you delete files in Terminal or delete folder Terminal, the items won’t be put to Trash. Reasons for Choosing Delete Directory TerminalĪfter moving files and folders to Trash, you can easily recover them if you find they are still useful. With this tool, you can perform almost all the system tasks that you can do with the help of the graphic interface. Alternatively, run the command from a user (or the superuser using sudo) that has full permissions to the files and directories you're deleting to prevent these prompts in the first place.In addition, you can delete directory using Terminal, which is a command line tool built in every macOS. If you start getting too many prompts about files without write access, then you can try it with -f. As a general rule, try first without the -f: if there are problems with your arguments, then you'll notice. When you use it, you won't be warned if your arguments supply a non-existing directory or file(s): rm will just silently fail to delete anything. However, in normal cases you don't need it, and using it suppresses some problems that you probably do want to know about. Many people suggest using -f (combining it into -Rf or -rf), claiming that it gets rid of annoying prompts. However, if you are deleting many files this is not going to be very practical. It is a good idea to always double-check which directory you're in, and whether you typed the command correctly, before pressing Enter.Īdding -i makes it a little safer, because it will prompt you on every deletion.

However, you need to be careful with a recursive command like this, as it's easy to accidentally delete a lot more than you intended.
