Skip to content
/ rm Public

Safe rm for macOS — moves files to Trash instead of permanent deletion. Drop-in Swift replacement for /bin/rm.

License

Notifications You must be signed in to change notification settings

ansilithic/rm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rm

Swift 6.0 macOS 14+ License: MIT

Drop-in rm replacement for macOS that moves files to Trash instead of permanently deleting them.

How it works

rm delegates to /usr/bin/trash so every deletion is recoverable from the macOS Trash. It accepts the same arguments as /bin/rm — files go to Trash silently on success, with errors printed to stderr on failure.

Supports -f (suppress errors for missing files) and -- (end of options for filenames starting with -). All other flags are accepted and ignored — files always go to Trash regardless.

Install

brew install ansilithic/tap/rm

Or build from source (requires Xcode and macOS 14+):

make build && make install

Ensure /usr/local/bin appears before /bin in $PATH to shadow the system rm.

Usage

rm [-f] [--] file ...

Examples

# Move files to Trash
rm file.txt
rm *.log

# Silently skip missing files
rm -f maybe-exists.txt

# Handle filenames starting with -
rm -- -weird-name.txt

License

MIT

About

Safe rm for macOS — moves files to Trash instead of permanent deletion. Drop-in Swift replacement for /bin/rm.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors