Note: FIRST read this thread on XDA to determine which boot-to-root to download. As of today (2017-01-24), I used v2.78 SR3 for non-TWRP.

1. In Developer options, enable OEM unlocking

2. Unlock bootloader (this only works on Pixel directly bought from Google, not carrier versions):
(a) boot into bootloader mode:

adb reboot bootloader

(b)

fastboot flashing unlock

then confirm on phone

3. Download boot-to-root image from Chainfire (read this thread on XDA to determine the download version), then

fastboot boot boot-to-root.img

Note: after root, if Pixel is stuck in the booting process (e.g. because wrong version of boot-to-root.img is used), flash the factory boot.img from Google (fastboot flash boot boot.img), normal reboot, and repeat Step 3 above.

This procedure works on macOS 10.12.2

Establishing build environment:
1. Creating a case-sensitive disk image

hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g ~/android.dmg

2. Mount the image

hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android

Continue reading