Drastically Free Up Resources on Your MacBook/OSX in Terminal

Listen to this Post

The macOS system generates an enormous amount of logging data in real-time, which can consume significant system resources. By adjusting the logging levels for specific subsystems, you can drastically reduce this overhead.

Commands to Reduce Logging Overhead

Run these commands in Terminal as root to disable excessive logging from the `com.apple.CoreSuggestions` subsystem:

sudo log config --subsystem com.apple.CoreSuggestions --mode "level:off" 
sudo log config --subsystem com.apple.CoreSuggestions --mode "persist:off" 
sudo log config --subsystem com.apple.CoreSuggestions --mode "stream:default" 

Verify Log Reduction

Check the logging output before and after applying the changes:

log show --info --debug --style syslog --predicate 'subsystem != ""' --last 1s | wc 

Before:

  • Thousands of lines per second
  • High CPU and disk usage

After:

  • Only a few dozen lines per second
  • Reduced system load

You Should Know:

1. Viewing System Logs in Real-Time

Use `log stream` to monitor logs dynamically:

log stream --level debug --style syslog 

2. Filtering Logs by Process

To see logs from a specific process (e.g., kernel):

log show --predicate 'process == "kernel"' --last 10m 

3. Clearing Logs to Free Disk Space

Delete all logs (requires `sudo`):

sudo rm -rf /var/log/ 

4. Disabling Other Noisy Subsystems

If other subsystems generate excessive logs, disable them similarly:

sudo log config --subsystem SUBSYSTEM_NAME --mode "level:off" 

5. Checking System Performance Impact

Use `top` or `htop` to monitor CPU and memory before/after changes:

top -o cpu  Sort by CPU usage 

6. Persisting Log Configurations

To ensure changes persist after reboot:

sudo defaults write /Library/Preferences/logging.plist SUBSYSTEM_NAME -dict-add "Level" "off" 

7. Alternative: Use `sysdiagnose` for Log Analysis

Generate a full system report:

sudo sysdiagnose 

What Undercode Say

Optimizing system logging is crucial for performance, especially on resource-constrained MacBooks. Disabling unnecessary logging subsystems (like CoreSuggestions) can significantly reduce CPU and disk I/O overhead.

Additional Useful Commands:

  • Check disk space usage:
    df -h 
    
  • List largest files in /var/log:
    sudo du -ah /var/log | sort -rh | head -n 10 
    
  • Disable Spotlight indexing (if not needed):
    sudo mdutil -a -i off 
    
  • Flush DNS cache (useful after network changes):
    sudo dscacheutil -flushcache 
    
  • Reset SMC (System Management Controller) for hardware issues:
    sudo shutdown -r now  Then hold Ctrl+Option+Shift+Power 
    

Expected Output:

After running the logging reduction commands, expect:

  • Lower CPU usage (visible in `Activity Monitor` or top)
  • Reduced disk writes (check with `iotop` or fs_usage)
  • Faster system responsiveness (especially on older MacBooks)

For further reading on macOS logging:

References:

Reported By: Activity 7318918691503427584 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image