I got Raspbian on a SD card, and then accidentally wiped it. Now I have 2 visible partition. How do I get rid of the partition on a Mac.

  • 3
    Would you mind giving us a few more details about your problem? It's a bit unclear what you're asking.
    – Munesawagi
    Feb 2, 2016 at 23:04
  • Try Disk Utility?
    – Downgoat
    Feb 3, 2016 at 0:51

7 Answers 7


The diskutil command on macOS is incredibly powerful and can do all that you need. (You can run the following in the Terminal app.)

Find your SD card:

$ diskutil list


$ diskutil list external physical

On the right, under IDENTIFIER, you'll see your disk labeled like disk2 or disk3, etc. You can use that label to reference your SD card from now on. I'm going to use disk2 for my example commands, but make sure you use your actual identifier.

For a board like the Raspberry Pi, you'll want FAT32 with MBR (Master Boot Record). Run:

$ diskutil eraseDisk FAT32 RASPBIAN MBRFormat disk2

...making sure disk2 is your SD card identifier from earlier. RASPBIAN can be anything. It'll name the Volume, which is what you'll see once it's mounted. The eraseDisk command will handle unmounting and remounting of the disk, so you don't need to worry about that.

That should be all that you need. You will end up with one FAT32 partition. It will look something like the following if you run diskutil list external:

/dev/disk2 (external, physical)
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.8 GB    disk2
   1:                 DOS_FAT_32 RASPBIAN                15.8 GB    disk2s1

You can then copy over the Raspbian NOOBS files to the SD card.

If you want to fully zero out or randomize your SD card, you can run:

$ diskutil unmountDisk disk2

...and then:

$ diskutil zeroDisk disk2


$ diskutil randomDisk disk2

(The zeroDisk/randomDisk command seems to prefer an unmountDisk command beforehand.)

Afterwords, you'll need to run that eraseDisk command from earlier to format it in order to be able to use the SD card.

Many other commands are available. Run man diskutil to see them all (q to quit the manual page).

  • 3
    This should be the correct answer.
    – Błażej
    Aug 31, 2018 at 5:42
  • 2
    I had to remove the external from diskutil list external because my iMac has an SD card slot that shows up as internal. Otherwise excellent advice!
    – chiborg
    Aug 20, 2019 at 20:47

Assuming Disk Utility doesn't work, try formatting the card using the SD Association's official formatting utility. It may seem a bit silly to download a program just for formatting SD cards, but I've had it fix all sorts of strange errors when nothing else worked, including disk utility / diskutil.

  • 1
    Upvoted. This is the "peace of mind" and user-friendly answer. I definitely wouldn't want to use terminal to wipe a disk and erase the wrong one... Nov 2, 2020 at 17:22
  • Thanks - the Terminal approach wasn't working for me, but this utility worked in a few seconds.
    – Tom M
    Nov 11, 2020 at 12:08
  • This utility sometimes formats cards smaller than they should be. eg. 2GB as 1GB. Oct 5, 2022 at 10:22

Using Terminal:

diskutil list

diskutil unmountDisk /dev/diskX (X is number of disk from step 1)

sudo dd if=/dev/urandom of=/dev/diskX bs=1000000 (X is number of disk from step 1)

Then wait! You can press ctrl + t to see dd status.

  • 2
    You can type sudo dd if=/dev/urandom of=/dev/diskX bs=1000000 && say "SD ready" to be notified! ;-) Aug 31, 2018 at 19:00
  • 2
    Is it really necessary to overwrite the whole disk for this (it will take ages on big disks)?
    – nohillside
    Jan 14, 2023 at 10:05

I'll try a short step by step method:

Open Terminal.


diskutil list

find the device identifier of the memory card, it will be smthg like /dev/diskX

The format command is:


This will reformat the disk DEVICIDENTIFIER with one partition with file system FILESYSTEM and give it the name CARDNAME. Careful, all other partitions will be removed!

  • Replace DEVICEIDENTIFIER with the device identifier from above, e.g. /dev/disk3 or whatever your disknumber is.
  • Replace CARDNAME with the name you want to give your memory card
  • Replace FILESYSTEM with your desired filesystem identifier. You can get a list of available filesystems with:

    diskutil listFilesystems

so as an example: diskutil eraseDisk FAT32 MYCARD /dev/disk3 -> formats the memory card /dev/disk3 as a single partition FAT32 card named "MYCARD"


Use Disk Utility to repartition the drive. It should be able to accomplish everything you need, including reformatting as well if you need it.

  • 2
    when i go on disk utility it does not give me a partition option
    – paul
    Feb 5, 2016 at 22:10
  • i wiped both partitions and i actually have 3 but i can only see 2 and the other one is storage
    – paul
    Feb 5, 2016 at 22:13
  • @paul I'm not sure what you're saying. Can you try rephrasing it?
    – JMY1000
    Feb 5, 2016 at 22:45
  • on my mac it is not letting me make changes. What do i do?
    – paul
    Feb 6, 2016 at 14:31
  • @paul Okay, what is it doing that isn't letting you make changes? Are there error messages? Can you add screenshots?
    – JMY1000
    Feb 6, 2016 at 19:53

MacOS seems top be unable to erase a "RECOVERY" partition. Raspbian creates that partition on the card. When trying to erase the partition with either the Disk Utility app or diskutil, the operation fails with a "Couldn't Unmount Volume" error.


Use the Apple disk Utility. First select the boot partition, click the erase button, give it the name you want it to have, and click erase. Now your SD card will have only one partition with the name you have given it.

You must log in to answer this question.

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