Is there an open source alternative to diskutil available for macOS? I am hoping to find a command line program that perform the same core functions like:

  • verify disk or volume

  • repair disk or volume

  • mount disk or volume

  • partitioning disk etc.

  • obtain info on a disk

  • obtain activity on a disk

And maybe can perform more functions than the above. And which can be compiled to run on macOS.

Reason for this: I am trying to learn the internals of such disk functions. diskutil is not open source unfortunately. I just need something similar, I do not need support for HFS or APFS if this is a problem. Also, I have tried tracing back to the BSD's diskutil version on which macOS diskutil is based, but I cannot seem to find a way to simply obtain the binary for diskutil and the source code, it seems to be lumped together with the entire kernel's code on (https://cgit.freebsd.org/src/).

I do not have enough experience/knowledge to navigate the source tree.

Any suggestion will be really appreciated.

  • 2
    Can't really see the point in going back to the original BSD, especially if you don't have HFS or APFS support. FAT doesn't really seem to be worth the effort, as it contains none of the finesse of HFS [or even NTFS] let alone APFS.
    – Tetsujin
    Oct 28, 2021 at 13:24

2 Answers 2


Not sure what's out there for macOS, but here is the source code for gparted: https://github.com/GNOME/gparted. It's written in C++.


No - not on macOS or Apple provided systems. If you want to start with diskutil nonetheless, there are tools to help guide you on this path, I would start with Hopper - a disassembler. You don’t need the source to see what Apple has shipped

Your learning might be faster though if you do not need Apple specific things like HFS or APFS by studying an OS to which all the source is open.

You must log in to answer this question.

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