Skip to content

Instantly share code, notes, and snippets.

@jonathanbarton
Last active October 3, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanbarton/822af7788017e33c0de4235f46133147 to your computer and use it in GitHub Desktop.
Save jonathanbarton/822af7788017e33c0de4235f46133147 to your computer and use it in GitHub Desktop.
Steps for Cloning / Formatting / Imaging SD Card for Raspberry Pi: OSX

Optional: Displaying Copy Progress

Optionally, you can install pv command to display inline cli progress bars for dd command.

brew install pv

Insert SD and Identify

diskutil list

Sample Output:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            250.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +249.8 GB   disk1
                                 Logical Volume on disk0s2
                                 38A1A2C1-733C-42D8-BE7B-C0EDFE0CEB87
                                 Unlocked Encrypted

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        +9.8 MB     disk3
   1:        Apple_partition_map                         32.3 KB    disk3s1
   2:                  Apple_HFS VNC-Viewer-6.17.731-... 9.8 MB     disk3s2

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk4
   1:             Windows_FAT_32 boot                    43.8 MB    disk4s1
   2:                      Linux                         31.9 GB    disk4s2

SD Card device in this listing is /dev/disk4

Clone Existing Image

sudo dd if=/dev/disk4 of=~/Desktop/backup123.dmg

If you are using pv:

sudo pv /dev/disk4 | dd of=~/Desktop/backup.dmg

Format

sudo diskutil eraseDisk FAT32 RASPBIAN MBRFormat /dev/disk4

Image

sudo diskutil unmountdisk /dev/disk4
sudo dd if=2017-07-05-raspbian-jessie.img of=/dev/disk4 bs=5m

If you are using pv:

sudo dd if=2017-07-05-raspbian-jessie.img | pv | sudo dd of=/dev/disk4 bs=5m

Alternative UI Tools:

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