How can stop iTerm2 from using the mounted disk I cd'd into? Sometimes, even when i cd out, it's still blocking the disk. I have to ⌘-Q the entire program which is very irritating. It's just idling anyway, there is no point in blocking the disk. So how can I disable it? I'm surprised I couldn't find any Google results either.

Force unmounting the disk does the trick for the time being: diskutil unmount force /Volumes/MyVolume, however, I'm looking for a cleaner solution.

  • 4
    The culprit here is not iTerm2 but OS X itself. Every process has assigned an open file/directory cwd (it can be inspected in the shell using lsof -p $$ | grep cwd). Since every process inherently uses a CWD, I see only 2 ways to resolve this: 1) Apple changes this behaviour (very unlikely), or 2) ask Bash mailing list to resolve this issue by occupying eg /tmp when idling, and only changing directory to the actual CWD when spawning processes. (maybe not that unlikely)
    – Danyel
    Jan 16, 2018 at 5:40
  • 1
    I'm guessing the fact that cding out doesn't work sometimes is due to spawned background processes/workers.
    – Danyel
    Jan 16, 2018 at 14:13
  • Just contacted bug mailing list. I proposed implementing this behind a shopt -s cwdspoof option
    – Danyel
    Jan 16, 2018 at 15:16
  • After you cded in what commands have you run before cding out?
    – mmmmmm
    Feb 5, 2018 at 14:11
  • @Mark not sure, I couldn't reproduce it since I had figured that that's probably the cause.
    – Danyel
    Feb 5, 2018 at 19:21


Browse other questions tagged .