Which hidden files you can safely delete from your Mac

0
4


Some files in macOS may not be necessary and can be safely removed from your Mac. Here’s how to delete them.

macOS is a UNIX-based system at its core, and as such, its filesystem arrangement is more complex than it first appears.

This is partly because macOS and the Finder hide parts of the filesystem on disk from users, mostly parts that only macOS needs and which most users never need to be concerned about.

Hidden away in these obscure parts of the filesystem are a variety of files and folders that don’t get used much, or that don’t really affect the day-to-day operation of macOS.

There are also some files which are visible normally in macOS on the volume it is installed onto and which aren’t hidden.

Showing hidden files

In the macOS Finder, you can view the filesystem by turning on hard disk volumes on the Desktop in Settings->General->Hard disks and Settings->General->External disks. There are also options for viewing server and optical storage volumes on the Desktop.

Once you’ve turned these settings on, you can view each volume’s filesystem on the Desktop by double-clicking its icon. Each volume will open into a Finder which displays its contents – files and folders.

But hidden away on the volume macOS is installed onto are additional hidden files and folders, as mentioned above. You can show these by opening a volume’s window in Finder and pressing Command-Shift-. (Command-Shift-period) on your Mac’s keyboard.

You can also turn on all invisible files in the Finder on all volumes by using the macOS Terminal app and the defaults command. To learn how to do this, see our previous article How to use invisible files in macOS.

Once you’ve shown invisible files, if you double-click the icon of the volume macOS resides on, you’ll see the root-level of your Startup Disk with hidden files and folders visible. You’re now ready to look for hidden files and folders to remove from your Mac’s Startup Disk.


The macOS Startup Disk’s root level with hidden files shown.

Temporary files, caches, and the home folder

macOS and some apps may keep small temporary files in the locations /private/var/tmp and /private/tmp. Most of these can be safely deleted unless they’re locked (that is, if they have the red circle with a white dash on them).

However, some temporary files in these folders may be in use by applications, so check first if they are in use before deleting them.

Most files in /tmp folders are removed every time you restart your Mac.

Another area where hidden files live is in cache folders. Caches are folders that are kept across reboots by macOS or apps which improve performance.

It’s a good idea to delete these caches from time to time to force them to be rebuilt. Doing so can also reduce used drive space since some caches may only be occasionally accessed.

The main cache folders in macOS are at /Library/Caches and in the user’s home folder (~) at ~/Library/Caches. Note that the /Library folder in the current user’s home folder is usually hidden also so you’ll have to show hidden files to view it in the Finder.

The ~/Library/Caches folder can sometimes grow to ten thousand files or more, depending on how many apps you use regularly.

The ~/Library/Caches folder can grow quite large, and it’s usually safe to delete most everything in this folder that isn’t locked or in use. However, use caution when doing so.

You may also want to restart after removing these items in order to force macOS to rebuild them.

Inside the user’s home folder itself, you may notice some hidden files and folders building up that you rarely or never use. You can safely delete these as long as they don’t contain any configuration files for apps or system services you use (such as SSH or source code control systems).

Logs

Most UNIX-based systems keep text files containing logs of what goes on daily on each computer. macOS is no different.

In particular, in macOS, the folders /private/var/logs and Users/~/Library/Logs contain most log files. There are also log folders for crash reports and a /Library/Logs/DiagnosticReports folder. Most of (but not all) the files in these folders can be safely deleted.

For example, be aware that if you use the Apache web server on your Mac, its log and error files reside in these folders. If you delete them, Apache won’t recreate them for you automatically, which means you may miss errors or log info that Apache might want to report.

There’s also a /Library/Application Support/CrashReporter folder, which contains files related to each app crash that occurs on your Mac. If you’re not interested in the crash data, you can safely remove these files.

You can also view most of these log files using macOS’ Console app found in the /Applications/Utilities folder. Open it and click the logs on the left you want to view to see their contents.

User-removable files

There are a number of non-hidden files that users can remove from macOS if they’re not needed. In particular, if you don’t want all the user pictures and only use a few of them, you can remove the ones you don’t use at /Library/User Pictures.

There is also a 23MB Apache web server HTML manual folder located at /Library/WebServer/share/httpd/manual and a general Documentation folder at /Library/Documentation.

Both the /Library and ~/Library folders contain Application Support folders, which over time can build up to contain files for most apps.

If you find you only use some apps occasionally and don’t need their configurations, you can usually safely delete sub-folders in these folders. Just be sure they don’t contain any long-term app settings files you might need later before you wipe them.

If you use Spotlight, over time its index files and caches can build up on your Startup Disk – sometimes reaching several hundred MB. If you want to remove these see our previous article How to stop Spotlight hogging disk space on macOS.

In the /Library folder itself, there is a Cookies folder, which can contain some web cookies stored by web browsers. You may want to delete cookie files in this folder. But be aware that if you do, you might lose some website settings the next time you visit those sites.

Also in the /Library folder is the Fonts folder. You can remove any font files contained in this folder by dragging them out of the folder to another location for storage. Doing so deactivates and disconnects them from the font system in macOS.

If you’re a developer, the /Library/Developer folder stores parts of Xcode, its emulators, and other associated files. If you delete these, you can recreate them by running Xcode and asking it to reinstall critical files and components.

Also, be aware that some of your developer profiles and signing certificates may reside in this folder (all of which you can re-download from Apple later).

The /Library/Preferences folder stores .plist and other files that contain settings for macOS and third-party apps. You may want to go through this folder from time to time and remove any settings files you don’t use.

It’s best not to remove any of Apple’s files starting with “com.apple” in this folder, as those are used by macOS and may be required.

Utilities

There are a variety of third-party apps and utilities out there that can “clean” your Mac and most of these files for you. Some of these apps are quite good, but others can have rather dubious origins.

One great app for viewing the total volume space on each volume is DaisyDisk ($9.99 with a free trial) from Software Ambience Corp.

DaisyDisk lets you view each volume’s contents by folder and size, and then decide which folders to mark for removal. Once you’ve selected all the folders you want to remove, you can do so with one click in the app.

This makes it a very handy app for maintenance.

Removing unused files should speed up your Startup Disk’s performance. Remember that it’s not just how much total space is used on the Startup Disk which affects performance – it’s also how many total files are on it.

In general, a Startup Disk with fewer files speeds up overall system performance since file system searches by the OS are faster. This is because the volume’s file catalog trees, which have to be traversed, are also shorter.

Once you know where to look, it’s easy to keep your Startup Disk free of extra files and space-wasting caches you no longer need or will rarely use.



Source link