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




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


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


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


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


Automating Screen Context: Why Every macOS Engineer Needs Peekaboo

Think of it as the bridge between an LLM (Language Model) and what's actually happening on your screen. Whether you're building a coding assistant or an automated QA bot


Streamline Your macOS Menu Bar: A Dev's Guide to Ice

As a software engineer, your menu bar can get cluttered with icons from various apps and tools you use daily—think Docker


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


The Software Engineer's Secret Weapon for Fast Image Display: SDWebImage

This library is essentially a robust, full-stack solution for asynchronously loading images from the network and managing them efficiently


Goodbye Browser Warnings: Secure Your Local Development with mkcert

When you're developing a web application, you often want to simulate a production environment as closely as possible. This includes using HTTPS