Pete Freitag Pete Freitag

Cleaning up Development Disk Space CommandBox

Updated on August 21, 2020
By Pete Freitag
coldfusion

I've been using CommandBox to startup CF servers on my dev laptop and desktop for several years, maybe even since the first version was released! CommandBox does a great job of hiding its internal magic, and thus the amount of disk space it consumes can creep up on you. To make matters worse it stores everything in a hidden folder under your home directory (usually in ~/.CommandBox), so it is easy to miss.

If you are on a Mac, you can run this command to see just how much space your CommandBox is currently using for its cache.

du -sh ~/.CommandBox/*

This will show you the size of each of subfolder in that directory. I have been doing a good job of keeping things trim on my development laptop, which only has a 128GB hard drive. But on my desktop, which has ample storage, I don't really worry about disk size too much.

So when I ran that command on my desktop, I was expecting some large disk usage numbers, and I was not let down. The artifacts folder was 8.8GB, the servers folder was 61GB, the serverJREs was nearly a gig, and the temp directory was 7.3GB. In total it was over 80GB!

Cleaning up CommandBox servers

If your servers folder is large, this is a good place to start. As a ColdFusion Consultant, I spin up new servers all the time, and as you can see, I often forget to delete them. Each server will contain an uncompressed version of the CFML engine, potentially some log files. The size can add up quick, and if you have a lot of temporary servers you can free up a lot of space.

List servers in CommandBox

Run this command to list all your servers by name:

box server list

Now for each server you are not using you can run:

box server forget serverNameOfAServerIOnceCreated

Cleaning up CommandBox artifacts

Artifacts are things that CommandBox downloads, such as CFML engines, or modules like testbox, coldbox, etc. Because I do a lot of CFML product development, I often need to test things on multiple CFML engines. Each time you download a different version of a CFML engine this is cached, so you can start up a new server quickly with that version next time.

List CommandBox artifacts

box artifacts list

From running that I found that I had 25 versions of ColdFusion (each update of the major version is counted as a different version), and 19 different versions of Lucee in my cache.

If you just want to clear out the cache, you can run:

box artifacts clean

If you would rather remove items by name, say you want to clean out all versions of lucee you would run:

box artifacts remove lucee

If you just want to delete a specific version from the cache you can do that as well:

box artifacts remove lucee 5.1.2+24

Cleaning up CommandBox temp Directory

The last big directory to clean up is the temp directory under the CommandBox home. I'm not quite sure how it got so large in my case. I think there is probably room for improvement in CommandBox to optimize that a bit better on its own. To clean this one, I think it would be safe to just empty the folder on the file system directly.

Update: About 1 hour after I published this, Brad found and fixed an issue (will go into CommandBox 5.2) that was causing files to remain in the temp directory. Thanks Brad!



commandbox disk space

Cleaning up Development Disk Space CommandBox was first published on August 21, 2020.


FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.

CFBreak
The weekly newsletter for the CFML Community