Skip to content
Mementropy
Lab NotesHomelab notebookField note

An agent shell hung on macOS Downloads and Documents

find ~ blocked on macOS privacy prompts that a headless shell can't answer.

By Ryan Hammang

I was looking for a kubeconfig file and some notes on my Mac workstation.

The AI agent I was working with ran find ~ -maxdepth 3 in the background. It hung. Later an ls on ~/Downloads and on the iCloud Drive folder hung too. Each one had to be killed.

The cause is macOS privacy protection. Folders like Downloads, Documents and iCloud Drive need a permission grant. When a program without that grant reads them, the system waits for a permission dialog. The agent runs in a terminal session with no screen to click on, so it waits forever.

What I’m doing from now on:

  • Don’t run find ~ or ls on those folders from an agent shell.
  • Scope searches to folders that aren’t protected, like ~/.kube, ~/.ssh, ~/Developer and ~/homelab.
  • Use Spotlight (mdfind) when I need to search more widely.

It cost a few stuck background jobs before we understood it. Has anyone found a clean way to grant those folders to a headless session?