How to install Magisk
Magisk is installed by patching one image from your phone's own firmware in the Magisk app and flashing it back. Which image depends on your phone. This page helps you pick the right method, shows the whole process, and links to the full steps.
Last updated 7 sourcesHow we check pages
Already have Magisk?
Magisk's documentation strongly recommends upgrading from inside the Magisk app with Install → Direct Install. The methods below are for a first install only. See updating Magisk.
- BootloaderMust be unlockedUnlocking erases the phone
- ComputerNeededadb and fastboot (or a Samsung flash tool)
- Custom recoveryNot neededTWRP installs are deprecated
- Android version6.0+ (v30.7), 7.0+ (v31.1)Version support
Requirements
- An unlocked bootloader. How to unlock depends on the manufacturer (see the device guides). AOSP's bootloader rules say unlocking should trigger a factory reset, so back up first.
- A computer with Google's
adbandfastboottools (SDK Platform-Tools), a USB cable, and some familiarity with them. Magisk's guide assumes you know how to use both. - The stock firmware for the exact build installed on your phone (Settings → About phone → Build number). Where to get it: finding the stock image.
- Android 6.0 or newer for v30.7; v31.1 needs Android 7.0 or newer.
- If you also plan to install a custom kernel, Magisk's guide says to install it after Magisk.
Choose your method
Install the Magisk app and open it. The home screen shows a Ramdisk value: whether your boot partition contains a ramdisk, the small file system Magisk needs to modify. Answer the questions below in order.
Which install method fits your phone?
- YesDoes Download mode show an OEM Lock value, on One UI 7 or older?
- YesPatch the firmware's
APfile and flash it in Download mode. Samsung guide - NoCannot be unlocked: Magisk can't be installed
- Yes
- NoMagisk app home screen: Ramdisk?
- NoPatch
recovery.imgwith Recovery Mode ticked - YesDoes your firmware contain
init_boot.img?- YesPatch
init_boot.img(unless the kernel is Android 12 GKI or older: thenboot.img) - NoPatch
boot.img(vendor_boot.imgon the few devices that keep the ramdisk there)
- Yes
- No
find_boot_image script. Samsung unlock status as of October 2026. Interactive version: root method checker.| Result | What it means | Full steps |
|---|---|---|
init_boot.img | Most phones that launched with Android 13 or later keep the generic ramdisk in a separate init_boot partition (AOSP); some don't, so check the guide for your brand. Magisk's own installer only uses it when the kernel is newer than Android 12 GKI, so a phone with an Android 12 kernel still gets boot.img. | Patch a boot image |
boot.img | Phones that launched with Android 12 or earlier keep the ramdisk in boot, even after upgrading to newer Android. | Patch a boot image |
vendor_boot.img | A few devices keep the ramdisk in vendor_boot. Supported since Magisk v30.3 (first stable: v30.6). | Which image |
recovery.img | Ramdisk: No. Magisk takes over the recovery partition, and you boot through the recovery key combination whenever you want root. | Magisk in recovery |
Samsung AP file | You patch the whole AP_*.tar.md5; the app picks the image inside. The first install needs a full data wipe and trips the Knox warranty bit for good. One UI 8 removed the unlock option, and US and Canada models can't be unlocked. | Samsung guide |
Two details from Magisk's source and docs help here. On A/B phones (phones with _a and _b partition slots), the app always reports Ramdisk: Yes, so the recovery method never applies. And Magisk's guide notes that some Xiaomi devices accept a boot ramdisk even when the app says No; the only way to find out is to try.
Googlebooks (Aluminium OS) have their own method in Magisk's v31.1 guide: the app patches the recovery image and writes it to a USB drive, without wiping data.
The whole process
From a stock phone to a rooted one
- 1Unlock the bootloaderErases the phone
- 2Get the stock firmwareExact build you run
- 3Patch in the Magisk appOn the same phone
- 4Flash the patched file
fastboot flashor Download mode - 5Reboot and finish setupApp shows an installed version
| Stage | What you do | Where people get stuck |
|---|---|---|
| 1. Unlock | Enable OEM unlocking in Developer options, then unlock from the bootloader (fastboot flashing unlock on most brands). Steps per brand: device guides. | The OEM unlocking toggle is greyed out or missing (some models and carrier versions don’t allow unlocking). Some brands use their own unlock process. Samsung on One UI 8 can’t be unlocked. |
| 2. Firmware | Download the full firmware for your exact build, not an incremental update. | Only a payload.bin in the zip; picking a different build. See getting the stock image. |
| 3. Patch | In the Magisk app: Install, then Select and Patch a File (v30.7) or Patch firmware / image (v31.1). | Patching boot.img on an init_boot phone; patching on a different phone. |
| 4. Flash | adb pull the result, then fastboot flash init_boot (or boot, vendor_boot, recovery). | Fastboot can't see the phone, or the partition name is wrong. See fastboot errors. |
| 5. Finish | Reboot, open the app, accept the additional setup, and let it reboot once more. | Not Installed or N/A, or a bootloop. |
Never flash a patched image someone else made, or one patched on another phone, even the same model. Magisk's guide warns you may need a full data wipe to recover. Always patch on the phone you are rooting.
What erases data
- Unlocking the bootloader: AOSP says the device should perform a factory data reset on unlock.
- Samsung's first install: Magisk's guide requires a full wipe on top of the unlock wipe (you flash
CSC, notHOME_CSC). - Disabling verification on
vbmeta: optional, and Magisk's guide warns it may wipe data. - Relocking the bootloader later: AOSP says locking resets the device. See relocking safely.
Custom recovery (TWRP) installs
Installing by renaming the Magisk APK to .zip and flashing it in a custom recovery still exists, but Magisk's documentation calls it deprecated and "maintained with minimum effort", and no longer recommended on modern devices. It only works on phones whose boot partition has a ramdisk. After flashing, install the APK as a normal app if it isn't there, open it, and let it reinstall Magisk from inside the app.
Magisk's v31.1 guide adds a warning for this route: modules' sepolicy.rule files can live on the cache or metadata partition, so don't wipe either in recovery, or those rules are lost until you reinstall the modules.
After installing
- Grant root: on v30.7 apps ask with a pop-up. On v31.1 there are no pop-ups; allow each app in the Superuser tab first. How root requests work: su.
- Add modules from the Modules tab. Start with one at a time. See modules.
- Banking and payment apps: an unlocked bootloader fails Play Integrity's DEVICE verdict on Android 13 and newer. Read Play Integrity and root before you rely on one.
- System updates: turn off automatic updates in Developer options and follow keeping root through updates.
Questions people ask
Can I install Magisk without a computer?
Not for the first install on a phone. The patched image has to be written with fastboot or, on Samsung, a flash tool in Download mode, and both run on a computer. Unlocking the bootloader also needs one on most brands. Once Magisk is installed, updates happen inside the app with Direct Install, no computer needed.
The only computer-free route in Magisk's v31.1 guide is for Googlebooks, where the app writes a patched recovery image to a USB drive.
Can I install Magisk without unlocking the bootloader?
No. Magisk's guide lists an unlocked bootloader as a requirement. A locked bootloader only boots images signed by the manufacturer, and a Magisk-patched image is not. Apps or websites that promise root without unlocking are not Magisk.
Does installing Magisk wipe my data?
Unlocking the bootloader does: AOSP says the device should perform a factory reset when it is unlocked. On Samsung, Magisk's guide says the first install needs a further full wipe. Disabling verification on vbmeta (optional) may also wipe data. Magisk's guide does not list a wipe for flashing a patched boot or init_boot image on other phones. Back up first anyway.
Do I need TWRP or another custom recovery?
No. Patching an image in the Magisk app and flashing it with fastboot is the main method. Magisk calls the custom recovery method deprecated and "maintained with minimum effort", and it only works on phones whose boot partition has a ramdisk.
Should I install v30.7 or v31.1?
v31.1, the current stable release, unless your phone runs Android 6.0. v30.7 (February 2026) works on Android 6.0 and newer, shows root permission pop-ups, and can hide the Magisk app. v31.1 (October 25, 2026) needs Android 7.0 or newer, removes pop-ups (you grant root ahead of time in the Superuser tab), removes app hiding, and can patch straight from a factory image zip or a link. See which file to download.
Will I still get system updates?
On A/B phones you can install an official update and keep root with Install to Inactive Slot (After OTA). On other phones you re-root after each update, and rooted Samsung phones can't take OTAs at all. See keeping root through updates.
I also want a custom kernel. In which order?
Magisk's guide says to install a custom kernel after Magisk.
The app says "Not Installed" or "Installed: N/A" after I flashed
Magisk is not running. The usual causes are patching the wrong image (for example boot.img on a phone that needs init_boot.img) or an image from a different build. See root not detected.
The phone won't boot after flashing
Flash the stock image from the same firmware back to the same partition (not on Samsung, where you flash the full firmware). Then check you patched the right image for the right build. See fixing a bootloop after flashing.
No match. Try another word from the error message.
Sources
This page is written from the sources below. If anything here disagrees with them, the upstream source is correct.
- Magisk installation guide (topjohnwu)
- Magisk changelog (topjohnwu)
- Generic boot partition and init_boot (Android Open Source Project)
- Implement A/B updates: slot suffixes and fastboot variables (Android Open Source Project)
- Lock and unlock the bootloader (Android Open Source Project)
- util_functions.sh: find_boot_image and the init_boot kernel check (Magisk source)
- app_functions.sh: Ramdisk and A/B detection, restore_imgs (Magisk source)
Found a mistake or something out of date? Tell us and we will check it against the source and fix the page. Confirmed corrections are listed in the corrections log.
Report a problem with this page