If you already have Magisk installed, it is strongly recommended to upgrade directly via the Magisk app using its “Direct Install” method. The following tutorial is only for the initial installation.
Before you start:
Download and install the latest Magisk app. We use the app to gather some information about your device. In the home screen, you should see this:
Pay special attention to the Ramdisk info. The result of this info determines whether your device has ramdisk in the boot partition.
(Unfortunately, there are exceptions as some devices’ bootloader accepts ramdisk even if it shouldn’t. In this case, you will have to follow the instructions as if your device’s boot partition does include ramdisk. There is no way to detect this, so the only way to know for sure is to actually try. Fortunately, as far as we know, only some Xiaomi devices are known to have this property, so most people can simply ignore this piece of information.)
If your device does not have boot ramdisk, read the Magisk in Recovery section before installing. The information in that section is VERY important!
If you are using a Samsung device and the SAR result is Yes, please check its own section.
Otherwise, continue to Patching Images.
(P.S.1: If your device has boot ramdisk, you can also install Magisk with a custom recovery, but it is not recommended)
(P.S.2: Huawei devices are not supported, and the instructions are removed from this page.)
If your device has boot ramdisk, you need a copy of the
If your device does NOT have boot ramdisk, you need a copy of the
You should be able to extract the file you need from official firmware packages or your custom ROM zip (if using one). If you are still having trouble, go to XDA-Developers and look for resources, guides, discussions, or ask for help in your device’s forum.
adb pull /sdcard/Download/magisk_patched_[random_strings].img
fastboot flash boot /path/to/magisk_patched.imgor
fastboot flash recovery /path/to/magisk_patched.imgif flashing a recovery image
The easiest way to uninstall Magisk is directly through the Magisk app. If you insist on using custom recoveries, rename the Magisk APK to
uninstall.zip and flash it like any other ordinary flashable zip.
If your device does not have ramdisk in boot images, Magisk has no choice but to hijack the recovery partition. For these devices, you will have to reboot to recovery every time you want Magisk enabled.
Since Magisk now hijacks the recovery, there is a special mechanism for you to actually boot into recovery mode. Each device model has its own key combo to boot into recovery, as an example for Galaxy S10 it is (Power + Bixby + Volume Up). A quick search online should easily get you this info. As soon as you press the combo and the device vibrates with a splash screen, release all buttons to boot into Magisk. If you decide to boot into the actual recovery mode, long press volume up until you see the recovery screen.
As a summary, after installing Magisk in recovery (starting from power off):
(Note: You CANNOT use custom recoveries to install or upgrade Magisk in this case!!)
If your Samsung device is NOT launched with Android 9.0 or higher, you are reading the wrong section.
Unlocking the bootloader on modern Samsung devices have some caveats. The newly introduced
VaultKeeper service will make the bootloader reject any unofficial partitions in some cirumstances.
VaultKeeperservice has unleashed the bootloader.
APtar file to your device. It is normally named as
adb pull /sdcard/Download/magisk_patched_[random_strings].tar
AP, together with
HOME_CSCbecause we want to wipe data) from the original firmware. This could take a while (>10 mins).
Once you have rooted your Samsung device, you can no longer upgrade your Android OS through OTA. To upgrade your device’s OS, you have to manually download the new firmware zip file and go through the same
AP patching process written in the previous section. The only difference here is in the Odin flashing step: we do NOT use the
CSC tar, but the
HOME_CSC tar instead as we are performing an upgrade, not the initial install.
recoverypartitions back to stock! You can brick your device by doing so, and the only way to recover from this is to do a full Odin restore with data wipe.
APtar file with reasons mentioned above. Always patch
APin the Magisk app and use that instead.
AP, or else Odin may shrink your
/datafilesystem size. Flash
This installation method is deprecated and is maintained with minimum effort. YOU HAVE BEEN WARNED!
It is very difficult to accurately detect the device’s information in custom recovery environments. Due to this reason, installing Magisk through custom recoveries on modern devices is no longer recommended. If you face any issues, please use the Patch Image method as it is guaranteed to work 100% of the time.
.apkfile extension to
.zip, for example:
Magisk-v22.0.zip. If you have trouble renaming the file extension (like on Windows), use a file manager on Android or the one included in TWRP to rename the file.
sepolicy.rulefile of modules may be stored in the
cachepartition. DO NOT MANUALLY WIPE THE