<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mili Cardenas</title>
    <description>The latest articles on DEV Community by Mili Cardenas (@atl).</description>
    <link>https://dev.to/atl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1621279%2Fe1a7aa15-0157-4045-af31-4dc4d01ecc65.png</url>
      <title>DEV Community: Mili Cardenas</title>
      <link>https://dev.to/atl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/atl"/>
    <language>en</language>
    <item>
      <title>All my git repos in one file: manage them day to day, rebuild them on a new machine</title>
      <dc:creator>Mili Cardenas</dc:creator>
      <pubDate>Fri, 20 Nov 2026 05:19:33 +0000</pubDate>
      <link>https://dev.to/atl/all-my-git-repos-in-one-file-manage-them-day-to-day-rebuild-them-on-a-new-machine-1k40</link>
      <guid>https://dev.to/atl/all-my-git-repos-in-one-file-manage-them-day-to-day-rebuild-them-on-a-new-machine-1k40</guid>
      <description>&lt;p&gt;I work across many repos: AI projects, a marketing site, an architecture studio's tools. Each has its own folder, its own remotes, and sometimes its own email and signing key. For years, that map lived in my head. Then I'd commit to a client repo with the wrong email, or set up a new laptop and spend an afternoon remembering what to clone.&lt;/p&gt;

&lt;p&gt;So I wrote &lt;strong&gt;&lt;a href="https://milyzc.github.io/git-projects-manager/" rel="noopener noreferrer"&gt;git-projects&lt;/a&gt;&lt;/strong&gt;: one YAML file that describes every project, and a few commands to manage them all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiss1r0kcan8ytf2cjdc4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiss1r0kcan8ytf2cjdc4.png" alt="git projects list -i" width="798" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One file for every project
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;projects-ai&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;defaults&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;                      &lt;span class="c1"&gt;# inherited by every project in the section
&lt;/span&gt;    &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Ada Lovelace&lt;/span&gt;
      &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ada@ai-lab.example&lt;/span&gt;
      &lt;span class="na"&gt;signingkey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/.ssh/ai_signing.pub&lt;/span&gt;
      &lt;span class="na"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/projects-ai/agent&lt;/span&gt;
    &lt;span class="na"&gt;remote&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git@github.com:ada-lab/agent.git&lt;/span&gt;
  &lt;span class="na"&gt;rag-service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/projects-ai/rag-service&lt;/span&gt;
    &lt;span class="na"&gt;remote&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git@github.com:ada/rag-service.git&lt;/span&gt;
      &lt;span class="na"&gt;upstream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git@github.com:ada-lab/rag-service.git&lt;/span&gt;
    &lt;span class="na"&gt;submodules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;projects-marketing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;landing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/projects-marketing/landing&lt;/span&gt;
    &lt;span class="na"&gt;remote&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git@github.com:ada-studio/landing.git&lt;/span&gt;
    &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;paused&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sections&lt;/strong&gt; group repos by client, team or area. Each section can set defaults that its projects inherit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Each project&lt;/strong&gt; has its path, one or more remotes, branch and submodules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity per project&lt;/strong&gt;: name, email, and SSH, GPG or x509 signing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status&lt;/strong&gt; (&lt;code&gt;active&lt;/code&gt;, &lt;code&gt;paused&lt;/code&gt;, &lt;code&gt;archived&lt;/code&gt;) keeps old projects on record without cluttering your day.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What you can do with it
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;command&lt;/th&gt;
&lt;th&gt;what it gives you&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git projects&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;every repo in one table: missing, clean or dirty, branch, ahead/behind&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git projects list -i&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;who each repo commits as, so you can spot the wrong email before you push&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git projects clone&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;clones what's missing; existing repos only get missing remotes, submodules and identity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git projects check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;validates the file and reports drift between the file and the disk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git projects paths&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;one path per line: &lt;code&gt;for d in $(git projects paths); do git -C "$d" fetch; done&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There are also a few flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--section&lt;/code&gt; and &lt;code&gt;--status&lt;/code&gt; filter any of these commands.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;clone --dry-run&lt;/code&gt; previews what would change.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;clone --protocol https&lt;/code&gt; works on a machine without SSH keys yet.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;clone --adopt&lt;/code&gt; turns a backup folder without &lt;code&gt;.git&lt;/code&gt; into a connected repo, keeping your files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Submodules (current and future) get the right identity too, through an &lt;code&gt;includeIf&lt;/code&gt;, so nothing commits as &lt;code&gt;you@MacBook-Pro.local&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The big payoff: a new machine
&lt;/h2&gt;

&lt;p&gt;The file has no secrets, only paths, public URLs, names and emails. So it lives in your vault, next to your SSH keys. On a new laptop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/milyzc/git-projects-manager/main/install.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
op document get projects.yml --out-file ~/.config/git-projects/projects.yml   &lt;span class="c"&gt;# or Bitwarden, age...&lt;/span&gt;
git projects clone
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every repo comes back with its remotes, submodules and identity (&lt;a href="https://github.com/milyzc/git-projects-manager/blob/main/docs/vault.md" rel="noopener noreferrer"&gt;vault recipes&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It's safe to re-run. Existing repos are never overwritten, and URLs with credentials are refused. Git never prompts for a password. The whole tool is one bash script with embedded Python, using only the standard library.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it is not
&lt;/h2&gt;

&lt;p&gt;It doesn't run commands across repos like &lt;a href="https://myrepos.branchable.com/" rel="noopener noreferrer"&gt;myrepos&lt;/a&gt; or &lt;a href="https://github.com/nosarthur/gita" rel="noopener noreferrer"&gt;gita&lt;/a&gt;, and it doesn't lay out clones by URL like &lt;a href="https://github.com/x-motemen/ghq" rel="noopener noreferrer"&gt;ghq&lt;/a&gt;. It is one declarative file plus one idempotent command that makes the disk match it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/milyzc/git-projects-manager/main/install.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
git projects init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Site: &lt;strong&gt;&lt;a href="https://milyzc.github.io/git-projects-manager/" rel="noopener noreferrer"&gt;https://milyzc.github.io/git-projects-manager/&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
Code (MIT): &lt;strong&gt;&lt;a href="https://github.com/milyzc/git-projects-manager" rel="noopener noreferrer"&gt;https://github.com/milyzc/git-projects-manager&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feedback is very welcome, especially from people on Linux, people who sign with GPG, or people who use other vaults. If it saves you an afternoon, a ⭐ helps others find it.&lt;/p&gt;

</description>
      <category>git</category>
      <category>cli</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Proxmox VMs with Terraform (with or without cloud-init)</title>
      <dc:creator>Mili Cardenas</dc:creator>
      <pubDate>Mon, 17 Aug 2026 17:21:29 +0000</pubDate>
      <link>https://dev.to/atl/proxmox-vms-with-terraform-with-or-without-cloud-init-3hnb</link>
      <guid>https://dev.to/atl/proxmox-vms-with-terraform-with-or-without-cloud-init-3hnb</guid>
      <description>&lt;p&gt;If you run a homelab on Proxmox VE, you probably know the drill: you need "just one quick VM" to test something, and twenty minutes later you're still clicking through the UI — pick the template, set the disk, set the network, wait, SSH in, create a user, install a package... for a VM you might tear down tomorrow.&lt;/p&gt;

&lt;p&gt;That friction is what pushed me to write a small Terraform module that clones a VM template and, optionally, applies a custom cloud-init (users, packages, &lt;code&gt;runcmd&lt;/code&gt;) rendered from &lt;code&gt;.tftpl&lt;/code&gt; files. Nothing fancy — just enough to turn "let me spin up a VM" back into a one-command thing.&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses the &lt;a href="https://registry.terraform.io/providers/bpg/proxmox/latest" rel="noopener noreferrer"&gt;&lt;code&gt;bpg/proxmox&lt;/code&gt;&lt;/a&gt; provider.&lt;/li&gt;
&lt;li&gt;Cloud-init is opt-in — clone-only by default, one line to switch it on when you actually need custom setup.&lt;/li&gt;
&lt;li&gt;Templates in &lt;code&gt;cloud-init/*.tftpl&lt;/code&gt; accept custom variables via an &lt;code&gt;extra&lt;/code&gt; map, so the same base template can serve different VM roles (there's a &lt;code&gt;web.yaml.tftpl&lt;/code&gt; example that installs nginx).&lt;/li&gt;
&lt;li&gt;Outputs the VM's IP via the QEMU guest agent once it boots, so you're not hunting for it in the Proxmox UI.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp &lt;/span&gt;terraform.tfvars.example terraform.tfvars
terraform init
terraform plan &lt;span class="nt"&gt;-out&lt;/span&gt; plans/test1.tfplan
terraform apply plans/test1.tfplan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repo (with setup steps and the exact Proxmox API token permissions you'll need): &lt;a href="https://github.com/milyzc/proxmox-terraform-vms" rel="noopener noreferrer"&gt;https://github.com/milyzc/proxmox-terraform-vms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're in the same boat — homelab, Proxmox, tired of the manual dance — I'd genuinely love feedback or PRs. It's a small project today, but happy to grow it (multi-VM, more distros) if it's useful to others too.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>proxmox</category>
      <category>infrastructureascode</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>I built a zsh cleanup script for macOS dev machines — and learned more than I expected</title>
      <dc:creator>Mili Cardenas</dc:creator>
      <pubDate>Wed, 27 May 2026 05:19:02 +0000</pubDate>
      <link>https://dev.to/atl/i-built-a-zsh-cleanup-script-for-macos-dev-machines-and-learned-more-than-i-expected-2ff3</link>
      <guid>https://dev.to/atl/i-built-a-zsh-cleanup-script-for-macos-dev-machines-and-learned-more-than-i-expected-2ff3</guid>
      <description>&lt;p&gt;If you do iOS and Android development on a Mac, your disk is quietly dying.&lt;/p&gt;

&lt;p&gt;Between Xcode's DerivedData, old iOS DeviceSupport folders, Android SDK build-tools release candidates, stale &lt;code&gt;node_modules&lt;/code&gt;, CocoaPods cache and Docker leftovers — it's not unusual to have &lt;strong&gt;20–50 GB of junk&lt;/strong&gt; that your machine accumulated over months without ever asking.&lt;/p&gt;

&lt;p&gt;I got tired of manually hunting these down, so I wrote &lt;a href="https://github.com/milyzc/clean-mac" rel="noopener noreferrer"&gt;&lt;code&gt;clean-mac&lt;/code&gt;&lt;/a&gt;: a single zsh script that cleans 18 categories of dev waste, with a &lt;code&gt;--dry-run&lt;/code&gt; mode that shows you exactly what would be deleted before touching anything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/milyzc/clean-mac/main/clean.sh &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; clean.sh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;chmod&lt;/span&gt; +x clean.sh
./clean.sh &lt;span class="nt"&gt;--dry-run&lt;/span&gt;  &lt;span class="c"&gt;# always start here&lt;/span&gt;
./clean.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What it cleans
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;npm / yarn / pnpm cache&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cache clean&lt;/code&gt; + &lt;code&gt;store prune&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Homebrew&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cleanup --prune=all&lt;/code&gt; + &lt;code&gt;autoremove&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gradle cache&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/.gradle/caches&lt;/code&gt; — generated by Android builds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CocoaPods cache&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pod cache clean --all&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xcode DerivedData&lt;/td&gt;
&lt;td&gt;intermediate build artifacts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unavailable iOS simulators&lt;/td&gt;
&lt;td&gt;&lt;code&gt;xcrun simctl delete unavailable&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iOS DeviceSupport&lt;/td&gt;
&lt;td&gt;keeps only the 2 most recent versions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android SDK build-tools&lt;/td&gt;
&lt;td&gt;removes versions &amp;lt; 34 and all RCs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android SDK cmdline-tools&lt;/td&gt;
&lt;td&gt;removes old versions, keeps latest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node_modules&lt;/td&gt;
&lt;td&gt;removes folders not accessed in 60+ days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iOS simulator data&lt;/td&gt;
&lt;td&gt;wipes app data, keeps devices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android AVD snapshots&lt;/td&gt;
&lt;td&gt;removes snapshot dirs from each AVD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Swift PM cache&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/Library/Caches/org.swift.swiftpm&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Diagnostic Reports&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.crash&lt;/code&gt; and &lt;code&gt;.ips&lt;/code&gt; files older than 30 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Git repos&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git gc --prune=now&lt;/code&gt; on all local repos&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docker&lt;/td&gt;
&lt;td&gt;dangling images and stopped containers only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VS Code cache&lt;/td&gt;
&lt;td&gt;editor cache folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trash&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.Trash&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The script prints disk usage before and after each category so you always know what's actually gone.&lt;/p&gt;




&lt;h2&gt;
  
  
  The interesting bugs I hit writing it
&lt;/h2&gt;

&lt;p&gt;This is the part I actually want to talk about, because the script looked simple at first.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. zsh arrays are 1-indexed
&lt;/h3&gt;

&lt;p&gt;Coming from bash, my first version of the iOS DeviceSupport cleanup looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;VERSIONS&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DS_DIR&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-Vr&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;to_delete&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;VERSIONS&lt;/span&gt;&lt;span class="p"&gt;[@]&lt;/span&gt;:2&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;  &lt;span class="c"&gt;# bash: skip first 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This silently does the wrong thing in zsh. Arrays start at 1, not 0, so the slice is off by one. The fix is explicit loop bounds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;VERSIONS&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;(f)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DS_DIR&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; 2&amp;gt;/dev/null | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-Vr&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;COUNT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${#&lt;/span&gt;&lt;span class="nv"&gt;VERSIONS&lt;/span&gt;&lt;span class="p"&gt;[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt; COUNT &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 2 &lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  for&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt; &lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3&lt;span class="p"&gt;;&lt;/span&gt; i&amp;lt;&lt;span class="o"&gt;=&lt;/span&gt;COUNT&lt;span class="p"&gt;;&lt;/span&gt; i++ &lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DS_DIR&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;VERSIONS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;done
fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also note &lt;code&gt;${(f)...}&lt;/code&gt; — the &lt;code&gt;f&lt;/code&gt; flag splits on newlines instead of spaces, which matters because iOS DeviceSupport folder names contain spaces (&lt;code&gt;16.4 (20E247)&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Glob errors on an empty directory
&lt;/h3&gt;

&lt;p&gt;The Trash cleanup was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/.Trash/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When Trash is empty, zsh expands &lt;code&gt;*&lt;/code&gt; and finds nothing — and unlike bash, it throws an error instead of passing a literal &lt;code&gt;*&lt;/code&gt;. &lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; doesn't help because the error happens at expansion time, before the command runs.&lt;/p&gt;

&lt;p&gt;Fix: the &lt;code&gt;(N)&lt;/code&gt; glob qualifier enables &lt;code&gt;NULL_GLOB&lt;/code&gt; for that specific pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; ~/.Trash/&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;N&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Trash is empty, &lt;code&gt;*(N)&lt;/code&gt; expands to nothing and &lt;code&gt;rm&lt;/code&gt; is never called. Clean.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;code&gt;${(q)}&lt;/code&gt; quoting collapses array args
&lt;/h3&gt;

&lt;p&gt;For the &lt;code&gt;sdkmanager --uninstall&lt;/code&gt; call I originally built the command as a string to preview it in dry-run mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CMD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SDKMANAGER&lt;/span&gt;&lt;span class="s2"&gt; --uninstall &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;(q)TO_UNINSTALL[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
run_sh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CMD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;${(q)}&lt;/code&gt; adds shell quoting to each element — but inside a double-quoted string, the spaces between elements get backslash-escaped, so all packages collapse into a single argument. &lt;code&gt;sdkmanager&lt;/code&gt; receives one giant string and silently does nothing.&lt;/p&gt;

&lt;p&gt;The fix is to stop building a string and pass the array directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;$DRY_RUN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"  [dry-run] &lt;/span&gt;&lt;span class="nv"&gt;$SDKMANAGER&lt;/span&gt;&lt;span class="s2"&gt; --uninstall &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TO_UNINSTALL&lt;/span&gt;&lt;span class="p"&gt;[*]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SDKMANAGER&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--uninstall&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TO_UNINSTALL&lt;/span&gt;&lt;span class="p"&gt;[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. &lt;code&gt;-mtime&lt;/code&gt; vs &lt;code&gt;-atime&lt;/code&gt; on APFS
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;node_modules&lt;/code&gt; finder originally used &lt;code&gt;-mtime +60&lt;/code&gt; to find folders not modified in 60 days. But on APFS (which is what every modern Mac uses), a &lt;code&gt;node_modules&lt;/code&gt; that you only &lt;em&gt;read&lt;/em&gt; — &lt;code&gt;npm install&lt;/code&gt;, running tests, starting a dev server — won't update &lt;code&gt;mtime&lt;/code&gt;. You'd keep it forever.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-atime&lt;/code&gt; tracks last access, which is what you actually want here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find ~ &lt;span class="nt"&gt;-maxdepth&lt;/span&gt; 8 &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"node_modules"&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-atime&lt;/span&gt; +60 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Design decisions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It never removes things that are hard to get back.&lt;/strong&gt; Active Android SDK platforms, system images, platform-tools, named Docker volumes, available simulators, and any &lt;code&gt;node_modules&lt;/code&gt; accessed in the last 60 days are all untouched.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dry-run is a first-class feature, not an afterthought.&lt;/strong&gt; Every destructive operation goes through a &lt;code&gt;run()&lt;/code&gt; function that intercepts it in dry-run mode. Nothing gets deleted unless you run it without the flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It tells you what it found before removing it.&lt;/strong&gt; iOS DeviceSupport versions, &lt;code&gt;node_modules&lt;/code&gt; paths, Android packages — all printed before deletion so there are no surprises.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/milyzc/clean-mac/main/clean.sh &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; clean.sh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;chmod&lt;/span&gt; +x clean.sh
./clean.sh &lt;span class="nt"&gt;--dry-run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ &lt;a href="https://github.com/milyzc/clean-mac" rel="noopener noreferrer"&gt;github.com/milyzc/clean-mac&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback welcome — especially if there are other categories worth adding, or if something behaves differently on your setup.&lt;/p&gt;

</description>
      <category>devtools</category>
      <category>shell</category>
      <category>productivity</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
