Delete Apple Computer Junk Files (reproduced)

1: Disable SafeSleep sleep mode - can save 4GB-16GB of space

If we want to disable the SafeSleep function, we need to enter the following command in the terminal:

sudo pmset -a hibernatemode 0

Then navigate to /private/var/vm/ and delete the existing sleepimage file

cd / private / var / vm /

Delete the file using the following command

sudo rm sleepimage

Finally we want to prevent OS X from continuing to create the file, so we need the following command to generate an empty file that cannot be replaced

touch sleepimage
chmod 000 /private/var/vm/sleepimage

Of course, if you want to turn the SafeSleep function back on, just run the command below.

sudo pmset -a hibernatemode 3
sudo rm /private/var/vm/sleepimage

 

2: Remove the system voice file - can save 500MB-3GB+ hard disk space

If you don't use text-to-speech, then you certainly won't be using OS X's built-in voice files. You can delete these files to regain hard drive space. In the terminal application, use the following command, first navigate to the folder where the file is located:

cd /System/Library/Speech/

Then execute the delete command to delete all voice files

sudo rm -rf Voices/*

 

If you execute the command, you will not be able to use the system's text-to-speech feature.

3: Delete all system logs - can save 100MB-2GB hard disk space

The longer you use your Mac, the more system log files you have, which can grow depending on your computer's usage, errors, and services. These system log files are used for debugging and troubleshooting, and if you feel useless, you can delete them with the following command:

sudo rm -rf /private/var/log/*

System log files will be generated continuously, so you can execute this command periodically.

4: Delete the cache files generated by Quick View - can save 100MB-300MB of hard disk space

The Quick View feature is a built-in file preview feature in OS X. After selecting any file in the Finder, you can click the space to view the details of the file. However, the quick view function relies on the cache function to be smoother, and these cache files will continue to increase. Remove the cache with the following command:

sudo rm -rf /private/var/folders/

 

5: Delete Emacs - can save 60MB+ of hard disk space

If you don't even know what Emacs is, you can safely remove it. Emacs is the text editor in the terminal, if you are using too little space on the SSD, it is a good choice to delete it, and you can also use vi and nano to edit text in the terminal. Here is the command to remove Emacs:

sudo rm -rf /usr/share/emacs/

 

6: Delete temporary files - can save 500MB-5GB hard disk space

There are many kinds of cache files, such as web browsing records, application meta data, etc. The size of these cache files is related to the applications the user uses and the frequency of Mac restarts. In addition, many online music playing apps also generate a large number of cache files, we can delete these cache files with the following commands:

cd ~/Library/Caches/
rm -rf ~/Library/Caches/*

 

Reprinted: http://www.etwiki.cn/mac-os/1830.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326311443&siteId=291194637