How to Clear VS Code Cache on Mac to Fix Performance Issues

Cassie Xie
Last updated: Dec 16, 2024

Is your Visual Studio Code running slow, lagging, or freezing? Clearing the cache could help resolve these issues. Discover 4 simple ways to clear the VS Code cache on your Mac.

Visual Studio Code (VS Code) is one of the most popular code editors available today among developers. However, as you work on multiple projects and install various extensions, the cache in VS Code can grow significantly. Over time, this buildup may lead to slow performance, unexpected behavior, or even crashes. To maintain a smooth and efficient coding environment, it is important to clear the cache periodically.

This guide focuses specifically on clearing the VS Code cache on your Mac. But before diving into the steps, we will explain why clearing the cache matters.

How to Clear VS Code Cache on Mac to Fix Performance Issues

Why Should You Clear the Cache in Visual Studio Code on Mac?

Visual Studio Code, like any software, uses cache files to enhance performance by storing temporary data. This includes project settings, configurations, extension data, debugging logs, and other temporary files.

While caching is useful, an excessive or outdated cache can negatively impact performance, leading to slowdowns, lags, or even freezing. Even worse, a corrupted cache can cause crashes, potentially resulting in the loss of unsaved work on VS code.

Clearing the cache in Visual Studio Code on a Mac not only helps free up disk space but also restores the editor to a stable and optimized state.

How to Clear VS Code Cache on Mac

This part provides easy-to-follow steps to remove the VS code cache on your Mac, helping to enhance your development environment. It includes solutions to remove all caches at once and methods to clear certain cache files.

Method 1. Delete the cache folder for VS Code manually

The first way to clear the VS Code cache on your Mac is by manually deleting the cache files. Follow these steps to locate and remove the cache directory.

Don't worry about deleting the VS code cache. It will allow VS Code to rebuild it the next time you open the editor.

Step 1. Close VS Code completely on your Mac.

Step 2. Open Finder, click Go at the top menu and choose Go to Folder.

Step 3. Enter the following path: ~/Library/Application Support/Code

Step 4. Delete all all folders related to cache, backup, and local storage.

How to clear Visual Studio Code on Mac

Step 5. Empty your Trash and restart VS Code and see if the performance improves.

Method 2. Remove VS Code cached data via Terminal

If you are tech-savvy, you might prefer using Terminal commands to clear the Visual Studio Code cache. This method is simple enough even for tech novice - simply copy and paste the commands into the Terminal.

Step 1. Go to Finder > Applications > Utilities folder.

Step 2. Open Terminal.

Step 3. Type the following commands into the Terminal, pressing Return after each one to execute.

rm -rf ~/Library/Application\ Support/Code/Cache/ rm -rf ~/Library/Application\ Support/Code/CachedData/

How to delete VS Code cache via Mac Terminal

Method 3. Clear VS Code cache with a Mac cleaner app

If the manual steps seem too complicated or you are worried about missing some cache files, a Mac cleaner app like BuhoCleaner can make the process much easier. BuhoCleaner is built to help Mac users like you quickly clean up junk files, free up space, and keep your system running smoothly. With just a few clicks, it can accurately find and remove all VS Code cache files for you.

Step 1. Download BuhoCleaner on your Mac and launch it after installation.

DownloadFor macOS 10.10 and above
100,000+ Satisfied Users Worldwide

Step 2. Select the Flash Clean option from the left-side menu.

Step 3. Click Scan, and BuhoCleaner will immediately begin scanning your Mac for old and unnecessary files.

BuhoCleaner Flash Clean

Step 4. Once the scan is complete, click View Details to see all the junk files detected.

BuhoCleaner Scan Results

Step 5. Go to the User Cache Files category and use the search bar in the top-right corner to type "Visual Studio Code" to find VS code cache files specifically.

Clear VS Code Cache on Mac with BuhoCleaner

Step 6. Check the box next to the Visual Studio Code to select it.

Step 7. Click Remove, then confirm by clicking Remove on the pop-up. BuhoCleaner will delete all Adobe cache files in seconds.

Method 4. Clear the VS Code cache from the Command Palette

If you are experiencing issues with the content cache in VS Code, such as the editor displaying outdated file content, you can use a built-in command to clear the cache. A handy keyboard shortcut lets you access this command quickly and resolve the problem.

Step 1. Open the VS Code app on your Mac.

Step 2. Press Cmd + Shift + P to open the Command Palette.

Step 3. Search for commands like "Developer: Clear Cache", "Workspaces: Clear Cache", or "Clear Editor History" according to your needs.

How to clear VS Code on Mac via Command Palette

Step 4. Select the cache-clearing option, and VS Code will clear the cache for you.

More Tips for Preventing Cache Problems with VS Code

The steps above show you how to clear the VS Code cache on a Mac. If the issue persists, here are some extra tips and ways to prevent it in the future.

Disable problematic extensions

Certain VS Code extensions can create excessive cache and affect performance. If you think an extension might be the culprit, try disabling it temporarily by opening the Extensions view, finding the extension in question, and clicking Disable. Then, restart VS Code to check if the cache issues are resolved.

Use Cache-Clearing Extensions

Manually removing user-generated cache from the cache folder on your Mac usually resolves corrupted cache issues. However, if you need to clear a specific cache while using VS Code, consider searching the VS Code Marketplace for extensions designed for this purpose. These extensions can be installed directly in VS Code to help you manage and clear the cache efficiently.

Conclusion

This article outlines 4 ways to clear the VS Code cache on Mac. Among them, we recommend BuhoCleaner. Its powerful junk file cleaner allows you to effortlessly remove cache data from VS Code and other apps. Not only does it improve your Visual Studio Code environment, but it also optimizes your Mac's overall performance.

Cassie has been writing about technology for her entire career life - over 5 years. She enjoys diving into how Apple products work and then breaking it down in a way anyone can understand.