Beyond Storage: Optimizing Your Development Environment via Mole


Beyond Storage: Optimizing Your Development Environment via Mole

tw93/Mole

2026-01-08

You're asking about Mole (tw93/Mole), a specialized shell script designed to deep clean and optimize macOS. For us engineers, a cluttered system isn't just a storage issue—it can lead to slow build times, weird caching bugs, and a general "lag" that kills productivity.

Here’s a breakdown of why this tool is a gem for your workflow.

Think of Mole as a "Spring Cleaning" script for your terminal. While regular users might just care about disk space, engineers benefit from

Clearing Build Artifacts
It targets node_modules, Cargo registries, and DerivedData (if you do iOS/macOS dev), which can grow to dozens of gigabytes.

System Snappiness
By clearing system-level caches and flushing DNS, it ensures your environment stays predictable.

Automation
Instead of manually running five different commands to free up space, you run one script.

Mole is designed to be lightweight. You don't even strictly need to "install" it as a package; you can run it directly or alias it.

You can run it directly using curl. This is perfect if you just want a one-time clean

curl -s https://raw.githubusercontent.com/tw93/Mole/master/mole.sh | bash

If you want to use it regularly, I recommend downloading the script and adding it to your .zshrc or .bash_profile.

Clone or download the script

mkdir -p ~/scripts
curl -o ~/scripts/mole.sh https://raw.githubusercontent.com/tw93/Mole/master/mole.sh
chmod +x ~/scripts/mole.sh

Add an alias to your configuration
Open your ~/.zshrc and add

alias cleanup='~/scripts/mole.sh'

Reload your shell

source ~/.zshrc

Now, whenever your Mac feels a bit sluggish, you just type cleanup in your terminal!

Mole is essentially a collection of rm -rf and system maintenance commands. If you were to look at a simplified version of what it does, it looks something like this

#!/bin/bash

echo " Starting deep clean..."

# Clear macOS System Caches
sudo rm -rfv ~/Library/Caches/*

# Clear Homebrew Caches (The big one for devs!)
brew cleanup -s
rm -rf $(brew --cache)

# Clear Xcode DerivedData (If you're an Apple dev)
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Flush DNS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

echo " System optimized!"

Read the script first
As a rule of thumb, never pipe a script from the internet directly into bash without reading it. You can check the source at tw93/Mole.

First Run
The first time you run it, you might be surprised by how much space you recover (sometimes 20GB+ if you use Docker or Homebrew heavily).

Customization
Since it's just a shell script, feel free to fork it and add your own paths, like cleaning up specific project dist folders or log files.


tw93/Mole




A Developer's Toolkit: Navigating the jaywcjlove/awesome-mac List

The awesome-mac repository is essentially a curated list of high-quality macOS applications, categorized for easy browsing


Dockerized macOS for CI/CD and Cross-Platform Testing

Hey there! As a software engineer, you're probably used to a lot of different development environments. Sometimes, though


PowerShell for Engineers: Beyond Windows

From a software engineer's perspective, PowerShell is a fantastic scripting and automation tool. Here's why you'd want it in your toolbox


A Software Engineer's Guide to Clash Verge Rev

Clash Verge Rev is a modern, cross-platform GUI client for Clash, designed for Windows, macOS, and Linux. As a software engineer


From Code to Console: Understanding shadPS4 as a Software Engineer

Let's dive into shadPS4, a PlayStation 4 emulator written in C++, from a software engineer's perspective. This is a fascinating project that offers a lot of learning opportunities and practical insights


tldr-pages: Your Command-Line Cheat Sheet for Software Engineers

As software engineers, we frequently interact with the command line. Whether it's git for version control, docker for containerization


Stop Fumbling with Your Phone: A Guide to Seamless Android Control via escrcpy

Think of it as a polished, user-friendly graphical wrapper for scrcpy (the legendary command-line tool for mirroring Android devices). If you've ever struggled with tiny phone screens while debugging or hated switching between your mouse and a physical phone


Unleashing Local AI: Integrating k2-fsa/sherpa-onnx Across 12 Programming Languages

Simply put, it's an open-source, real-time speech and audio processing toolkit built on top of the next-generation Kaldi framework and leveraging ONNX Runtime for high-performance


The Power of WebKit: From Native Apps to Web Contribution

For a software engineer, WebKit is more than just a browser engine; it's a critical component for several use casesBuilding Custom Web Views You can embed a WebKit-based WebView directly into your native macOS or iOS application


How trycua/cua Solves Safety and Testing for Desktop Automation Agents

Let's break down what c/ua is, how it can be useful for you, and how to get started.The simplest way to understand c/ua is that it's "Docker for Computer-Use Agents