0

On macOS (eg. Mojave 10.14), what is the difference between the diskutil unmount and diskutil eject commands?

For example, if I want to execute this from the command line (eg. bash in terminal), but I want to have the same, ‘safe’ result as though I had clicked the eject icon in the Finder:

  • which command(s) should I use (and why)?
  • what are the differences and side-effects between these two?
2

You can at least be certain that diskutil eject does all that diskutil unmount does, plus (sometimes) more. Examples given in the man page mention removable media readers equipped with a motor to physically eject a volume, such as a CD-ROM player. Also, when there are more than one filesystem on the media, diskutil eject will unmount all volumes on the media, while diskutil unmount just unmounts the one filesystem you mention explicitly.

When in doubt, I'd always go for the eject verb.

  • This answer is possibly incomplete; corrections are welcome. – Harald Hanche-Olsen Apr 24 at 14:55
  • Since eject unmounts other volumes, it may not be the right ‘default’ action for everybody. – samh Apr 24 at 16:03
  • @samh Yes, that's one reason for writing “When in doubt”. – Harald Hanche-Olsen Apr 24 at 16:15
2

You unmount a volume, and eject a drive. For non-removable media, eject and unmount are equivalent. If the media is removable, eject tells the OS the media is to be removed and the OS releases all links to the drive. This question was asked on the apple discussion board and you can review the responses here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .