In Linux, the command sudo fdisk -l produces an output that lists all the disks and partitions in the computer. Here is an example:

Example of fdisk -l output

If I try to use sudo fdisk -l in MacOS X 10.7.5, the output is the following one:

fdisk: illegal option -- l
usage: fdisk [-ieu] [-f mbrboot] [-c cyl -h head -s sect] [-S size] [-r] [-a style] disk
    -i: initialize disk with new MBR
    -u: update MBR code, preserve partition table
    -e: edit MBRs on disk interactively
    -f: specify non-standard MBR template
    -chs: specify disk geometry
    -S: specify disk size
    -r: read partition specs from stdin (implies -i)
    -a: auto-partition with the given style
    -d: dump partition table
    -y: don't ask any questions
    -t: test if disk is partitioned
`disk' is of the form /dev/rdisk0.
auto-partition styles:
  boothfs     8Mb boot plus HFS+ root partition (default)
  hfs         Entire disk as one HFS+ partition
  dos         Entire disk as one DOS partition
  raid        Entire disk as one 0xAC partition

Is there a command in MacOS to replicate the behavior of fdisk -l in Linux?

up vote 43 down vote accepted

You can use the 'diskutil' tool for that:

% diskutil list
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage                         499.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           *498.9 GB   disk1
  • 1
    @VitoShadow - Make sure to accept the correct answer please (I think you can at your level). – nerdwaller Nov 9 '13 at 14:12
  • But what if I want to know the endblock of a partition? – johnboiles Sep 26 '14 at 18:58

As far as I remember...

For Mac OS X:

  1. diskutil (manpage) is a command-line tool for everything Mac OS X can handle, i.e. it will provide as much or more than Disk Utility can do graphically.
  2. For MS-DOS MBR (Master Boot Record) partitioned drives, use fdisk (manpage).
  3. For Apple APM (Apple Partition Map) partitioned drives, use pdisk (manpage).
  4. For Apple and (U)EFI GPT (GUID Partition Table) partitioned drives, use gpt (manpage).

If you want a GPT command that is fdisk-like, you should try gdisk "GPT fdisk" from Rod Smith. You can find (important) associated information here and download information here.

For Linux:

Modern Linux uses parted for partitioning, so fdisk may still be around, but you would really want to use parted instead.

  • GNU Parted parted supports all common partition tables, including MBR, APM and GPT. Most Linux distributions have good manuals for the use of parted, i.e. during installation, but I always recommend reading the wikipages from ArchLinux—IMHO they are the best, except that this particular one is currently not very up-to-date (Dec 30 2016)!
  • fdisk is for MBR partitions only. If you try to change the partition table on a GPT partitioned disk, you will instead corrupt the "protective MBR" which is part of the GPT specification. parted will prevent you from doing that!
  • pdisk has been ported from Darwin (the BSD base of Mac OS X) to Linux, so you could also use pdisk to create an APM partition table and manage its partitions. The problem is that modern Linux distributions don't include a precompiled package with pdisk anymore. Status of pdisk
  • mac-fdisk is the way to go on Linux/​PowerPC. Most x86 (and x64) distributions don't include mac-fdisk because it is big-endian only. Looking at Debian you see that only powerpc/​powerpc64 packages are available, except for experimental packages for m68k, but not x86. The only Linux I know of that has a working mac-fdisk on x86/​amd64 is Gentoo Linux.
  • For GPT partitions parted does a great job. If you want an fdisk-like command-line tool, you can use either gpt or gdisk, although there might be more...

To answer your question:

fdisk on macOS (previously OS X, originally Mac OS X) acts just the same, but you should check for the partitioning scheme used:

  1. x86-PCs (16-Bit, 32-Bit "i386" and 64-Bit "x64") with BIOS use(d) Master Partition Record (MBR).
  2. Intel Itanium (IA-64), x86-PCs (IA-32, this includes 64-Bit i.e. amd64 i.e. x64 i.e. x86-64) with UEFI and Intel-Macs, all of them use EFI/​UEFI (Universal Extensible Firmware Interface), use the GUID Partition Table (GPT).
  3. Apple Macintosh running on m86k (Motorola 68000 series of processors) and PowerPC use Apple Partition Map (APM).

This doesn't limit the particular partitioning scheme of external drives, naturally, since all of those computers can use each partitioning scheme on external media if the operating system supports it. But for internal drives, more specifically: boot drives, only the one partitioning scheme can be used.

Therefor: if you use fdisk on a Mac on an internal drive, you will have no luck, since there is no MBR on that drive. It is either APM or GPT. Likewise, if you use fdisk on a modern PC with UEFI (or an Intel Mac with EFI) you will only see the protective MBR of the GPT, not the real partition table.

For creating/​managing partitions, running fdisk on an external drive that uses MBR partitioning will work on macOS like it does on Linux.

For listing existing partitions on macOS (Mac OS X), use sudo diskutil list (see also this great article at On Linux, the equivilant is sudo parted -l, or if you want a specific drive only, sudo parted /dev/sda print.

  • And let’s not forget about the CoreStorage logical volume manager. – Daniel B Dec 30 '16 at 12:18
  • Reading though all this again, I realize that the short answer to the question really is to use diskutil. What I intended to point out was that fdisk may list partitions on Linux and obviously not on macOS, but using fdisk is risky because it is limited to MBR partitions. Modern drives come GPT partitioned– fdisk is out-dated and thus becomes dangerous since it will only list the protective MBR part of the GPT. Linux versions of fdisk have been modified to show GPT partitions as well, but macOS uses diskutil, so it seems there never was real need to use -l with fdisk anyway. – luttztfz Mar 5 '17 at 10:53
  • It gets even more confusing because there are GPT-capable versions of fdisk for Linux. Personally, I think it’s vastly superior to parted, too. – Daniel B Mar 5 '17 at 11:39
  • @DanielB: Yes, like I mentioned, some Linux versions of fdisk have been modified for use with GPT. IMHO the only really great tool for GPT on Linux and macOS is gdisk i.e. “gpt-fdisk”, but gpt will also work and on Linux-only parted will do the job right. It gets even more complicated with stuff like BootCamp or other multiboot setups, not to mention non-standard alignment and 4k sectors aka “Advanced Format”. I just find it interesting that fdisk—clearly a history MS-DOS name for a partitioning tool—is still in peoples minds for listing partitions, even on modern systems. – luttztfz Mar 17 '17 at 12:51

Simply use fdisk /dev/rdisk0 to get CHS and end block of a partition

LiuJianweis-iMac:~ liujianwei$ sudo fdisk /dev/rdisk0
Disk: /dev/rdisk0   geometry: 15566/255/63 [250069680 sectors]
Signature: 0xAA55
        Starting       Ending
 : id  cyl  hd sec -  cyl  hd sec [     start -       size]
1: EE 1023 254  63 - 1023 254  63 [         1 -  250069679] <Unknown ID>
2: 00    0   0   0 -    0   0   0 [         0     -      0] unused      
3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
4: 00    0   0   0 -    0   0   0 [         0 -          0] unused 
  • I got fdisk: /dev/rdisk0: Operation not permitted even if sudo password is given – Chang Qian Mar 9 at 7:21

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.