As we kick off the brand new 12 months, I believe it’s a good time to take a recent take a look at your construction device.

Over months of growing initiatives, trying out, and experimenting, your machine slowly fills up with unused dependencies, previous caches, and leftovers that consume up your device’s disk area.

On this article, we’ll stroll via some easy but sensible tactics to scrub up your dev device and regain a few of that disk area.

Let’s get started with Docker.

1. Blank-up Docker

Docker is excellent for spinning up constant construction environments, but it surely hardly ever cleans up after itself. Through the years, unused photographs, stopped bins, and leftover volumes can pile up and quietly soak up extra disk area than you are expecting.

To scrub issues up, you’ll run docker machine prune, which eliminates unused bins, networks, dangling photographs, and construct cache in a single move. For a deeper cleanup, upload the -a or --all flag to take away all unused photographs, no longer simply dangling ones—particularly helpful for those who ceaselessly transfer between other base photographs or runtime variations.

Docker system prune command terminal output

Continuously pruning Docker can release a stunning quantity of disk area. The one drawback is that you just’ll wish to re-pull photographs when you wish to have them once more. So if you wish to have a lighter possibility, you’ll merely run docker builder prune, which focuses handiest on clearing the construct cache and is perfect for those who construct photographs regularly.

2. Blank-up Homebrew

In case you’re the usage of Homebrew to regulate applications and apps put in on macOS, it’s most probably that over the years, previous variations of applications and cached downloads have collected to your machine.

Whilst Homebrew does some computerized cleanup, it handiest runs infrequently and will nonetheless stay caches for months. In case you’ve been the usage of your device for some time, the ones leftovers can simply develop into gigabytes.

To scrub issues up, you’ll run brew cleanup, and use the --prune=all flag that eliminates all unused cached recordsdata. You’ll be able to additionally pair this command with brew autoremove to delete orphaned dependencies which might be not wanted.

Homebrew cleanup command terminal screenshot

3. Blank-up NPM

Subsequent, we’re going to scrub up NPM, which helps to keep a neighborhood cache within the ~/.npm listing to hurry up installs.

In idea, this cache is “self-healing” and assessments its personal information for corruption, so that you shouldn’t wish to contact it. Actually, despite the fact that, the cache can nonetheless develop very huge over the years or get out of sync after failed installs or community problems.

You’ll be able to wipe this cache utterly the usage of npm cache blank --force. This eliminates the whole thing and forces NPM to re-download all applications sooner or later, which is able to decelerate long term installs and use extra bandwidth.

NPM cache clean force terminal output

If you wish to keep away from that, a more secure possibility is npm cache examine, which assessments the cache for issues and eliminates unused information with out clearing the whole thing. For many circumstances, that is the simpler technique to stay your NPM cache wholesome.

In my case, I used to be ready to reclaim greater than 100GB of my disk area after cleansing NPM caches on my own, which is lovely insane!

Blank-up “node_modules”

Some other of the most important area hogs in internet construction is the unending unfold of node_modules directories. Each and every challenge can simply soak up masses of megabytes, and much more than a gigabyte only for those dependency applications. In case you have numerous previous or inactive initiatives mendacity round, that’s an enormous chew of treasured SSD area going to waste.

That is the place npkill truly is useful. You’ll be able to run:

npx npkill

It’ll scan your challenge folders, record each and every node_modules listing it unearths, display you precisely how a lot area every one makes use of, and mean you can delete them with a unmarried keystroke.

npkill node_modules finder terminal interface

It’s highest for “parking” initiatives you’re no longer actively running on, since you’ll all the time regenerate node_modules later with a easy npm set up.

4. Blank-up NVM

NVM makes it simple to make use of more than one variations of Node.js. However over the years, it will probably additionally turn out to be a choice of old-fashioned or unused Node variations that soak up area and may also introduce safety dangers.

First, you’ll run nvm ls to look all of the variations you could have put in.

NVM list Node versions terminal output

Each and every model comes with its personal set of world applications, so the record can develop temporarily. Search for variations you not use, particularly the ones which might be end-of-life. You’ll be able to take away them safely with nvm uninstall .

Right here for instance, I’m going to take away Node.js 20, since all my initiatives are operating Node.js 22 or 24.

    nvm uninstall 20

5. Blank-up Native Repositories

In spite of everything, it’s a good suggestion to check your native Git repositories.

Over the 12 months, you’ll have cloned or created many repositories which might be not lively or wanted.

Whilst Git does some cleanup routinely, operating git gc manually assist you to compress previous information, take away unreachable gadgets, and accelerate on a regular basis Git operations.

Git garbage collection terminal command

For a deeper cleanup, you’ll additionally run git gc --aggressive, which does additional optimization.

On most sensible of that, you’ll additionally run git department -d $(git department --merged), which is able to delete all native branches that experience already been merged into your present department, serving to to stay your repository tidy.

6. (Bonus) Blank-up Ollama

Final however no longer least, for those who’re the usage of Ollama to run native AI fashions, it’s value checking for any unused fashions that can be taking on area.

Ollama is a great tool that makes operating LLMs in the community simple. However it will probably temporarily consume up disk area since every style may also be anyplace from a couple of gigabytes to tens of gigabytes, and trying out other variants ceaselessly results in numerous unused fashions piling up.

Get started via operating ollama record to look what you could have put in.

Ollama list installed AI models terminal

Then take away anything else you not use with ollama rm . In my case, I’ve two fashions, one that I not actively use, which is deepseek-r1:8b. It takes up round 5GB of area, so I’ll move forward and take away it.

Ollama remove model terminal command

Wrapping up

Taking a little bit time to take away equipment and recordsdata you not use is helping your laptop run higher. It may well additionally prevent from slowdowns or wonder problems later.

Now, confidently you’ve reclaimed a few of that treasured disk area and feature a cleaner dev device.

The put up Spring Blank Your Dev Gadget and Reclaim Disk Area gave the impression first on Hongkiat.

WordPress Website Development Source: https://www.hongkiat.com/blog/clean-dev-machine-free-disk-space/

[ continue ]