Android Device Setup
If you don't already have the Android Platform tools, install it through Brew:
brew install android-platform-tools
This will install the adb
& fastboot
tools.
Rooting Pixel 6 with Magisk
Step 1 – Prepare the Device
-
Boot the device up and open the Settings app
-
Scroll down and tap on the “About phone” section
-
At the bottom is the Build Number – Write this down exactly as it is listed there!
-
-
Tap on the Build number 7 times to enable Developer mode
-
After Developer mode is enabled, go back one menu, and tap on “System => Developer options”
-
Enable USB debugging by toggling the switch to on
-
Enable OEM unlocking by toggling the switch to on
-
Exit the Settings app
Step 2 - Patch the Official Boot Image
-
Go to this link: https://developers.google.com/android/images
-
Scroll to the bottom of that page and click on the "Acknowledge" button
-
Find the image that matches your Android version & Build number exactly and download that file
-
Extract this zip file
-
Inside of the extracted files will be another zip file which is named something like
image-oriole-{BUILD.NUMBER}.zip
which is around 2GB in size. Extract this archive. -
Inside of those extracted files will be a file called
boot.img
-
Push the
boot.img
file to the deviceadb push boot.img /sdcard
-
Download the latest Magisk-v2x.0.apk file from https://github.com/topjohnwu/Magisk/releases
-
Install this on to your device
adb install Magisk-v24.0.apk
-
Open the Magisk app on the device and select “Install” in the top section of the Magisk card (not the Manager card)
-
Then choose “Select and Patch a File”
-
Tap on the menu icon in the upper/left and select the device “Pixel 6” which should take you to the
/sdcard
directory where theboot.img
is located -
Select the
boot.img
file that you uploaded earlier -
Magisk will patch the image and write out a new version of it in the
/sdcard/Download
directory -
Pull this new patched image back to your computer (for ease of use, put this in the same directory as the original
boot.img
fileadb pull /sdcard/Download/magisk_patched-24000_{random}.img
Step 3 – Unlock the Bootloader (this will delete all data)
-
Reboot the device to the bootloader menu
adb reboot bootloader
-
Unlock the BootLoader
fastboot flashing unlock
-
Use the volume controls on the device to switch it to “Unlock the bootloader” then use the power button to select that option
Step 4 – Flash the Patched Boot Image
-
Flash the patched boot image into the boot partition
fastboot flash boot magisk_patched-24000_{random}.img
-
Patch the vbmeta partition (the vbmeta.img file is in the same directory as boot.img)
fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img
-
Once that completes, reboot the device
fastboot reboot
(Note: In some cases, the device may not boot properly. If this happens, it will prompt you to wipe the data partition. Go ahead and do this. It will boot once that is complete)
Step 5 – Setup the Device
-
Boot the device up and open the Settings app
-
Scroll down and tap on the “About phone” section
-
Tap on the Build number 7 times to enable Developer mode
-
After Developer mode is enabled, go back one menu, and tap on “System => Developer options”
-
Enable USB debugging by toggling the switch to on
- If the device is still connected to the computer, you will be prompted to trust it
-
Exit the Settings app
-
Re-install the Magisk app you downloaded earlier as unlocking the boot loader likely removed it
adb install Magisk-v24.0.apk
-
Launch Magisk and perform the additional setup (if you get prompted for it) which will force another reboot
-
On your macOS system, open a Terminal and check for ‘SuperUser’ privileges
adb shell
suYou should be prompted in the Magisk app on the device if this is allowed. Tap on ‘Grant’, and you should get the familiar root prompt.
-
To install a Magisk Module, download the file and then push it to the device using adb push
-
Open Magisk
-
Tap the Modules tab on the bottom/right
-
Select Install from storage
-
Find the module and tap it to flash it to the device
- This will require a reboot following each install
-
-
In Magisk, I would suggest installing the following modules:
-
Magisk Frida (https://github.com/ViRb3/magisk-frida/releases)
-
SQLite for ARM aarch64 devices (https://github.com/Howard20181/sqlite3/releases)
-
Magisk Trust User Certs (https://github.com/NVISOsecurity/MagiskTrustUserCerts)
-