How can I make 'rm' move files to the trash can? I use the terminal on a daily basis, I will often use rm DirectoryName. Sometimes I get a little impatient and do rm * without deliberating if it’s safe. As you can imagine, these shenanigans have sometimes come back and hit me in the face. Does anyone know how I create a mapping so rm whatever moves everything to the trashcan which I then delete manually.
Bad Idea
Using rm to move files to the trash is a dopamine hit. It is common and pleasuring but can be bad for you taken out of context.
You really need control yourself when using rm. Especially if your backups are not current or you don’t have the time to do an erase / install / restore.

Don't use rm
Imagine, you get used to rm moving to trash and make a habit of it. Sure, your system is safe but when you log into a friend's (or your wife's or your boss') notebook and have to delete something? You'll be actually using the real rm - deleting those files forever. Without lots of prep and qualifiers, it's a bad habit, and you need to know that.
So instead, install rmtrash and make a habit of using it:
# install rmtrash, (either from the macports or by the brew.)
$ alias trash=&quot;rmtrash&quot;
$ alias   del=&quot;rmtrash&quot;       # del / trash are shorter than rmtrash


Correcting bad habits
Here’s where the personal advice starts - changing one’s behavior is hard.
Another thing you can do to force yourself to use rmtrash instead of rm is alias it to a custom message in your .profile.
alias rm=&quot;echo Use 'del', or the full path i.e. '/bin/rm'&quot;

So, whenever you use rm, you'll be prompted to either use rmtrash or /bin/rm. Remember, this is only temporary, after a while you should remove the alias.

Never ever, do something like this:
$ pwd
/
$ cd /tnp; rm -rf *
sh: cd: /tnp: No such file or directory

Pop Quiz: In what directory will the rmcommand run? :)