# Step by step Procedure

Following the [Arch Linux Raspberry Pi 3 Installation Guide](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3), it is possible to abstract the steps necessary to do this on macOS without any virtualization. It is a matter of understanding what is going on and knowing macOS tools (which are just enough different than GNU tools be be a pain).

A quick look at which filesystems are necessary: `mkfs.vfat` is just `mkfs.fat`, which can be FAT12, FAT16, or FAT32.

```
diskutil listFilesystems
-------------------------------------------------------------------------------
PERSONALITY                     USER VISIBLE NAME
-------------------------------------------------------------------------------
Case-sensitive APFS             APFS (Case-sensitive)
  (or) APFSX
APFS                            APFS
  (or) APFSI
ExFAT                           ExFAT
Free Space                      Freier Speicherplatz
  (or) FREE
MS-DOS                          MS-DOS (FAT)
MS-DOS FAT12                    MS-DOS (FAT12)
MS-DOS FAT16                    MS-DOS (FAT16)
MS-DOS FAT32                    MS-DOS (FAT32)
  (or) FAT32
HFS+                            Mac OS Extended
Case-sensitive HFS+             Mac OS Extended (Case-sensitive)
  (or) HFSX
Case-sensitive Journaled HFS+   Mac OS Extended (Case-sensitive, Journaled)
  (or) JHFSX
Journaled HFS+                  Mac OS Extended (Journaled)
  (or) JHFS+
ZFS                             ZFS Dataset
```

Indicates that MS-DOS FAT 32 is supported.

Acquire the necessary Arch Linux ARM tar.gz here https://archlinuxarm.org/about/downloads

```
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz.md5
```

Find my SD Card.

```
diskutil list
... 
(internal)
...
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   *64.1 GB    disk2
```

Apply FAT 32 Filesystem to my sd card like in step 3 of the guide. The `diskutil` help does not make it obvious how to run something like `mkfs.vfat`. `diskutil partitionDisk -h` is somewhat useful. Unlike on Linux, you do not need to unmount your SD card, because `diskutil partitionDisk` will do it automatically. 

```
                      #/dev/node  PARTSCHEME FS LABEL SIZE (R=remainder, 100%)
diskutil partitionDisk /dev/disk2 MBR FAT32 BOOT 100M FAT32 ROOT R
```

(replace disk2 with the device node of your sd card)

macOS will automount the new partition at `/Volumes/PI`, so skip the mount step.

Extract `ArchLinuxARM-rpi-3-latest.tar.gz `directly to the mount point. MacOS is closely related to BSD, so `tar` on macOS is `bsdtar`.

```
tar -xpvf ArchLinuxARM-rpi-3-latest.tar.gz -C /Volumes/ROOT
```

Now we just expanded everything to root, but the boot stuff needs to be on the BOOT partition. Move it over. You could use `mv` or be safer with `rsync`

```
mv /Volumes/ROOT/boot/* /Volumes/BOOT/
```

Flush out the kernel buffers to disk.

```
sync
```

Unmount and you are good to go (which probably flushes out the buffers anyway)

```
diskutil unmount /Volumes/{BOOT,ROOT}
```