Clean up OS X Hard Disk Space Command Line

Disable Safe Sleep Sleep mode - can save a 4GB-16GB of space

The following command can turn off the OS X native sleep function, which is SafeSleep. This sleep mode when the battery Mac will not sleep or the contents of memory stored on sleepimage files on the hard disk. sleepimage files with Mac computers as large memory, which means that if your memory is 4GB, the file will have 4GB, if it is 16GB, the file will have 16GB. Close SafeSleep state can not let the system automatically create the file, the disadvantage is that when the Mac is not the battery, you can not revert to the previous. However, we can use OS X's auto-save feature to save his job at the time the battery will be depleted.

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

$ sudo pmset -a hibernatemode 0

Then navigate to /private/var/vm/ delete files that already exist sleep image

$ cd /private/var/vm/

Use the following command to delete the file

$ sudo rm sleepimage

Finally, we want to prevent OS X continues to create the file, so we need the following command generates an empty file can not be replaced

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

Of course, if you want to re-open Safe Sleep feature, just below command.

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

Remove the system voice files - you can save the hard disk space 500MB-3GB+

If you are not applicable text-to-speech feature, then you certainly would not use the OS X built-in voice files. You can delete these files to regain disk space. In the terminal application, use the following command to first locate the folder where the file

$ cd /System/Library/Speech/

Then the delete command to delete all the voice files

$ sudo rm -rf Voices/*

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

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

As you use your Mac more and more time, system log files are also more and more, based on the amount of computer errors and services, these documents will be more and more. The system log file is used to debug and troubleshooting, if you feel there is no use, you can use the following command to remove

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

The system will continue to generate log files, so you can regularly execute this command.

Delete cache files generated by quickly preview - you can save a 100MB-300MB hard disk space

Quick preview feature is the built-in OS X system file preview function, you can click the box after selecting any file in the Finder to see the details of the file. But Quick View feature relies on caching feature can be more smooth, and these cache files will always increase, remove the cache using the following command

$ sudo rm -rf /private/var/folders/

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

/private/var/tmp/ storage system cache is a folder, it will clear when the system reboots normally, but sometimes it does not. And if you do not close a long time Mac, do not reboot, then the cache files will be more and more. Use the following command to clear these temporary files

$ cd /private/var/tmp/
$ rm -rf TM*

Clear the cache file - can save 1GB-10GB of hard disk space

There are many cache files, such as web browsing history, application meta data and so on. The capacity of the cache files with the applications users exactly how much to use, but also with Mac restart frequency. In addition, many online music player app will generate a lot of cache files, we can delete these cache files using the following command

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

Note that some methods have some risks, so please pay attention when using.

5.00 avg. rating (98% score) - 1 vote