Most of the time, my Mac's Terminal works great. However, when I use it to navigate the file system of my WD My Passport 1TB external drive, it... almost works. Almost. Simple commands like cd and ls work normally except that they don't appear to finish -- they leave the Terminal waiting at the last line of the ls results, rather than presenting the prompt. Effectively, I have to ^C after every single command (and I better hope it was actually finished when I do that).

  • This is a 2020 Intel Macbook Pro, 13" display, running Sonoma 14.4.1. The shell is zsh.
  • I haven't tried waiting more than a minute or so, on the assumption that it really shouldn't take that long for an ls.
  • It's only the WD 1TB drive that does it. Browsing files works normally* on my little SanDisk thumb drive and the Seagate external drive that I use for Time Machine. (* The Time Machine drive won't run ls, but that appears to be a Time Machine thing, and the "operation not permitted" error shows up promptly before going back to the normal prompt.)
  • Some commands work normally -- tar -xzvf on a 53GB tarball just finished and exited to the prompt. man tar did not, nor did less or a simple sed.

Why is this happening? Why is it only the one drive that does it?

edit: More information as requested in comments.

  • The problem drive is formatted ExFAT. The thumb drive is FAT32, the Time Machine drive is Mac OS Extended (Journaled), and the laptop's built-in SSD is APFS.
  • The problem disappears when I use a simple prompt (PS1="$ "). The problem prompt is "(base) [%T] %n @ %1~$(git_prompt_info) »", where git_prompt_info is a function defined in ~/.oh-my-zsh/lib/git.zsh :
# Outputs current branch info in prompt format
function git_prompt_info() {
  local ref
  if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
    ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
    ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
    echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"

Any idea why that might cause problems only on the one drive -- or, failing that, a way to use a different prompt only when that function hangs up? (I do like having the branch in my prompt and would love to give that function some way to handle whatever error is happening here.)

  • What filesystem is on the problematic drive? Commented May 28 at 18:21
  • It sounds like your shell prompt is trying to use something from the current directory, like display the pathname. But that wouldn't explain why it's dependent on the command.
    – Barmar
    Commented May 28 at 19:42
  • 1
    Does it happen if you set a very simple prompt, like PS1='$ '?
    – Barmar
    Commented May 28 at 19:43
  • @MarcWilson -- The problem drive is ExFAT. In case it's relevant: the thumb drive is FAT32, the Time Machine drive is Mac OS Extended (Journaled), and the laptop's built-in SSD is APFS. Commented May 29 at 16:53
  • @Barmar -- aha, it does not! My previous PS1 was (base) [%T] %n @ %1~$(git_prompt_info) », where git_prompt_info is a function from zsh that specifies git branch and such. Changing the prompt to $ fixed the problem, as did changing it back to the old one and just dropping the git_prompt_info function. I'll edit the function into the question text; any chance you can see why it was causing trouble? Commented May 29 at 16:54


You must log in to answer this question.

Browse other questions tagged .