Removes all /tmp directory files and deletes /Library/Caches files older than 30 days
This Automox Worklet™ removes temporary and obsolete files from macOS endpoints to recover disk space and optimize system performance. The Worklet deletes all files in the /tmp directory and purges cached application files older than 30 days from /Library/Caches.
Temporary files accumulate over time as applications store session data, temporary processing files, and intermediate downloads. Cache files older than 30 days are often stale application data that no longer serve a purpose. Cleaning these directories safely reclaims storage without affecting active system operations.
Storage capacity directly impacts endpoint productivity. When disk space becomes constrained, macOS slows down as the system struggles to manage limited resources. Removing unnecessary temporary files frees up gigabytes of storage on endpoints, preventing disk-full errors that disrupt user work.
Cache accumulation degrades performance over time. Legacy cache files from uninstalled or outdated applications consume storage without providing any benefit. Regularly purging old cache data helps maintain optimal system responsiveness.
Automating this maintenance task reduces manual intervention across your fleet. Instead of instructing users to manually clear caches or troubleshooting disk space issues, you deploy this Worklet to proactively maintain all macOS endpoints on a scheduled basis.
Evaluation phase: The Worklet checks whether files exist in /tmp and whether /Library/Caches contains any files with modification times older than 30 days. The evaluation completes without making changes to your endpoint.
Remediation phase: If cleanup is needed, the Worklet removes all files and subdirectories from /tmp and deletes all files matching the age criteria from /Library/Caches. The process logs deleted files to the Automox Activity Log for audit purposes.
macOS endpoints with standard directory structures (/tmp and /Library/Caches present)
Sufficient file permissions to delete files in /tmp and /Library/Caches directories
Bash shell and standard Unix utilities (find, which are built-in to macOS)
No open files or active processes locking temporary files (the Worklet handles locked files gracefully)
After remediation completes, your endpoint has significantly more free disk space. The amount recovered depends on accumulated temporary and cache data, but typical cleanup operations free between 500 megabytes to several gigabytes per endpoint.
You can verify the cleanup by checking available storage using Disk Utility or the command line with 'df -h'. System responsiveness should improve as macOS has more free disk space for operations. The Worklet successfully completes only when both the /tmp directory and cache cleanup operations finish without errors, which you can confirm in the Automox Activity Log.
Run this Worklet on a pilot macOS endpoint and review evaluation output for clean /tmp and /library/caches directory.
Confirm Automox activity logs show successful completion and exit code 0.
Verify endpoint state using checks aligned to evaluation script logic, such as else, exit, elif.
Validate remediation effects from script operations such as function, find, else, then rerun evaluation for compliance.
For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for clean /tmp and /library/caches directory. This supports repeatable system preferences workflows, faster change control review, and auditable compliance evidence.
Useful script references for this Worklet include evaluation operations such as else, exit, elif and remediation operations such as function, find, else. Use these indicators to verify that endpoint changes match intended policy outcomes.


By submitting this form you agree to our Master Services Agreement and Privacy Policy.
Already have an account? Log in
Consider Worklets your easy button
A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

AUTOMOX + WORKLETS™
Uncover new possibilities with simple, powerful automation.
By submitting this form you agree to our Master Services Agreement and Privacy Policy