1. Use third-party tools to clean up. This is the easiest way. This way is safer and more convenient if more consideration is given to convenience. It can automatically scan and clean up log files, cache files, junk files and so on. , and keep your Mac computer clean and tidy.
All you have to do is:
Install the third-party cleaning tool (Chiyou Diskgeeker) on the Mac computer; Then open the application and enter the main interface, and select your macOS data volume on the left;
Click the "clean up garbage" option in the toolbar on the right and wait for scanning;
After scanning, select the cache, logs and junk files according to your own needs, and then click the "Clean" button in the lower right corner.
Step 2 Wash by hand
Manual cleaning of log files can usually delete some old log files, such as those from a week or a month ago. It is worth noting: Do not delete the log files in use, otherwise it may affect the normal operation of the system.
Choosing this method requires you to have certain technical knowledge and risks. If you know something about terminal commands, you can use this method.
You need:
Open the Terminal program, press and hold the shortcut key "Command+ Space", and enter "terminal" to open it quickly;
Enter the following command. This command will delete all files and subdirectories in the "/var/log/" directory:
sudo rm -rf /var/log/*
Please click to enter a picture description.
3. Write a script that automatically cleans up on a Mac computer. You can use scripting language to write a scheduled task to clean up the log files regularly. The specific implementation method requires some programming skills and experience.