title: Mac OS High Sierra diskutil eraseDisk leads to Error: -69877: Couldn't open device
body: <p>I am having issue converting a new SanDisk 128GB microSD card from <code>ExFAT</code> to <code>FAT32</code></p>
  
  <pre><code>$ diskutil info /dev/disk2
  
    Device Identifier:        disk2
     Device Node:              /dev/disk2
     Whole:                    Yes
     Part of Whole:            disk2
     Device / Media Name:      Built In SDXC Reader
  
     Volume Name:              Not applicable (no file system)
     Mounted:                  Not applicable (no file system)
     File System:              None
  
     Content (IOContent):      FDisk_partition_scheme
     OS Can Be Installed:      No
     Media Type:               Generic
     Protocol:                 Secure Digital
     SMART Status:             Not Supported
  
     Disk Size:                127.9 GB (127865454592 Bytes) (exactly 249737216 512-Byte-Units)
     Device Block Size:        512 Bytes
  
     Read-Only Media:          Yes
     Read-Only Volume:         Not applicable (no file system)
  
     Device Location:          Internal
     Removable Media:          Removable
     Media Removal:            Software-Activated
  
     Virtual:                  No
  </code></pre>
  
  <p>Here is the mounted partition </p>
  
  <pre><code>$ diskutil info /dev/disk2s1
  
  Device Identifier:        disk2s1
     Device Node:              /dev/disk2s1
     Whole:                    No
     Part of Whole:            disk2
  
     Volume Name:              
     Mounted:                  Yes
     Mount Point:              /Volumes/Untitled
  
     Partition Type:           Windows_NTFS
     File System Personality:  ExFAT
     Type (Bundle):            exfat
     Name (User Visible):      ExFAT
  
     OS Can Be Installed:      No
     Media Type:               Generic
     Protocol:                 Secure Digital
     SMART Status:             Not Supported
     Volume UUID:              555AF300-2369-3CE8-B4E1-D8F976CE9C86
     Partition Offset:         16777216 Bytes (32768 512-Byte-Device-Blocks)
  
     Disk Size:                127.8 GB (127848677376 Bytes) (exactly 249704448 512-Byte-Units)
     Device Block Size:        512 Bytes
  
     Volume Total Space:       127.8 GB (127831900160 Bytes) (exactly 249671680 512-Byte-Units)
     Volume Used Space:        393.2 KB (393216 Bytes) (exactly 768 512-Byte-Units) (0.0%)
     Volume Free Space:        127.8 GB (127831506944 Bytes) (exactly 249670912 512-Byte-Units) (100.0%)
     Allocation Block Size:    131072 Bytes
  
     Read-Only Media:          Yes
     Read-Only Volume:         Yes
  
     Device Location:          Internal
     Removable Media:          Removable
     Media Removal:            Software-Activated
  </code></pre>
  
  <p>First I unmount:</p>
  
  <pre><code>$ diskutil unmountDisk /dev/disk2
  Unmount of all volumes on disk2 was successful
  </code></pre>
  
  <p>Then I erase the disk and format it to FAT32</p>
  
  <pre><code>$ diskutil eraseDisk FAT32 NEW_NAME /dev/disk2
  Started erase on disk2
  Unmounting disk
  Creating the partition map
  Error: -69877: Couldn't open device
  </code></pre>
  
  <p>How can I erase the disk and format it to <code>FAT32</code> without using third-party applications?</p>