keepcalculator

06 Numbers and Powers

Clear User Logs on Mac: Full Guide

Card No. 06·84834 · Updated · Standard formula, shown below

Yes, you can clear user logs on a Mac, and the method depends on whether you mean the system log files stored by macOS or the activity history inside a specific app. This guide covers both, showing you exactly which files are safe to delete, which commands to run, and which logs you should leave alone.

What Are User Logs on a Mac?

User logs are records of activity generated by apps, the system, and your own actions. They include:

  • System logs – messages from the kernel, drivers, and background services (stored in /var/log and /Library/Logs).
  • User-level logs – app-specific records under ~/Library/Logs (e.g., CrashReporter, DiagnosticReports).
  • App history – recent documents, search terms, or browsing history stored inside an app’s own preferences or database.

Most people want to clear logs to free up disk space, fix a misbehaving app, or remove traces of their activity. The steps differ for each goal.

How to Clear System Logs (Safe Methods)

macOS writes system logs to /var/log and /Library/Logs. You can clear them with the following commands in Terminal:

  1. Open Terminal (Finder → Applications → Utilities → Terminal).
  2. Run sudo rm -rf /var/log/* – this deletes all files in the system log directory. You’ll be prompted for your admin password.
  3. Run sudo rm -rf /Library/Logs/* – this clears logs from installed apps and services.
  4. Optionally, restart your Mac so the logging daemon recreates fresh empty files.

These commands are generally safe because the system recreates log files as needed. However, deleting logs while a service is actively writing can cause a temporary error; a reboot resolves it.

Clearing User-Level Logs in ~/Library/Logs

Your personal log folder contains crash reports, diagnostic data, and app logs. To clear them:

  1. Open Finder and press Cmd+Shift+G.
  2. Type ~/Library/Logs and press Enter.
  3. Select the files you want to delete (or select all with Cmd+A) and move them to Trash.
  4. Empty the Trash.

You can also do this in Terminal with rm -rf ~/Library/Logs/*. Be aware that some apps (like CrashReporter) will recreate these logs after the next crash or diagnostic event.

Clearing App-Specific History (Safari, Messages, Terminal)

If you want to clear the visible “history” inside an app, that’s different from deleting log files. Here are common examples:

  • Safari – Go to Safari → Settings → Privacy → “Manage Website Data” to remove cookies and site data, or “Clear History” in the History menu.
  • Messages – Delete individual conversations or use “Keep Messages” set to 30 days in Settings → General.
  • Terminal – Run history -c to clear the current session’s command history, and remove the ~/.bash_history or ~/.zsh_history file to clear past commands.
  • Recent items – Go to Apple menu → Recent Items → Clear Menu to remove recently opened documents and apps.

Using the “log” Command to Purge System Logs

macOS includes a unified logging system that stores data in a compressed binary format. You can purge it with:

  1. Open Terminal.
  2. Run sudo log erase --all – this deletes all logs from the unified logging system.
  3. Confirm with your password.

This is the most thorough way to clear system logs, but it also removes logs that might be useful for troubleshooting. After running it, the system starts fresh; no reboot is strictly required.

Common Problems and Misconceptions

“I cleared logs but disk space didn’t change.” This happens because many logs are tiny, or because the space was actually taken by caches (which are separate). Use “About This Mac” → Storage to see what’s really using space.

“Will clearing logs break my Mac?” No, the system recreates them. However, deleting logs while an app is actively writing can cause that app to crash or lose diagnostic data. It’s best to quit the app first.

“Does clearing logs improve performance?” Rarely. Logs are written in the background and don’t slow down the system unless disk space is critically low. Clearing them is mostly for privacy or troubleshooting.

Safety and What NOT to Delete

Never delete the following, as they are essential for the system to function:

  • /var/log/install.log – used by the installer; deleting it can cause update issues.
  • /var/log/system.log – a symlink to the unified log; deleting it may break log rotation.
  • ~/Library/Logs/DiagnosticReports – contains crash reports that Apple may request when troubleshooting; deleting them is safe but loses diagnostic info.
  • Any file that is currently open by a process – you’ll get an error, and forcing deletion can corrupt the process.

If you’re unsure, use the log erase command instead of manually deleting files, as it handles the unified log safely.

Frequently Asked Questions

Is it safe to delete all logs in /var/log?

Yes, generally. The system recreates them. However, if you have a running service that needs its log file to exist (like a web server), it may fail until the file is recreated. A reboot solves this.

How do I clear logs without Terminal?

Use Finder to go to ~/Library/Logs and delete files manually. For system logs, you need Terminal because they’re protected by SIP (System Integrity Protection) and require sudo.

Will clearing logs delete my personal files?

No. Logs are separate from your documents, photos, and apps. Only files inside the log directories are removed.

Does clearing logs affect my privacy?

It removes local records of activity, but it does not remove data that may be stored in iCloud or by third-party services. For privacy, also clear app-specific history and use a VPN.

Why do logs come back after I clear them?

Because macOS and apps continuously write new logs. That’s normal. If you want to prevent a specific app from logging, you can’t easily do that without disabling the app’s logging feature (if it has one).

Can I clear logs on an external drive?

Yes, if the external drive has a macOS installation, you can boot from it and clear its logs using the same commands. But if it’s just a data drive, it won’t have system logs.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →