Skip to content

Instantly share code, notes, and snippets.

@garethrees
Created April 28, 2020 15:32
Show Gist options
  • Select an option

  • Save garethrees/7b67db37c43415720da920499ab7231c to your computer and use it in GitHub Desktop.

Select an option

Save garethrees/7b67db37c43415720da920499ab7231c to your computer and use it in GitHub Desktop.
Format USB drive from the command line macOS
diskutil list
diskutil unmountDisk /dev/disk2
diskutil eraseDisk FAT32 SANDISK /dev/disk2
@rameshkpatra

Copy link
Copy Markdown

Hi,
It worked. Thank you so much.

@Pradeeparul2

Copy link
Copy Markdown

It's working, Thanks.

@Bugerman58

Copy link
Copy Markdown

Tnx! It's working method!🔥👍

@anuj-kumar-r

anuj-kumar-r commented Sep 2, 2024

Copy link
Copy Markdown

Thankyou soo much, the disk utility cannot fix the issue.
the commands fixed it.

@sbmaggarwal

sbmaggarwal commented Sep 22, 2024

Copy link
Copy Markdown

It's working, Thanks. To add secure erase config, we can use it like:

sudo diskutil secureErase 4 eraseDisk exFAT sandisk128 /dev/disk9

@laurajaime

Copy link
Copy Markdown

thanks!!! you saved my day

@Delspa1

Delspa1 commented Nov 17, 2024

Copy link
Copy Markdown

I need your help. It seems that my 128Gig SanDisk memory card has an internal write protection on and I cant erase anything on it. My MAC disk utility wont work, the adapter security switch doesnt help, it is locked on a software side of the SD Micro card.
Can yoiu help. I use a MAC and dont have a lot of experience with the Terminal side.

@zencd

zencd commented Jan 10, 2025

Copy link
Copy Markdown

unmountDisk is not required in practice, Sequoia.

@hantv15

hantv15 commented Mar 10, 2025

Copy link
Copy Markdown

Thank you, It's works.

@reubendevries

Copy link
Copy Markdown

unmountDisk is not required in practice, Sequoia.

Not required but also a good step to take for caution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment