Installation - GitCourser/MagiskOnEmu GitHub Wiki

Run Magisk installer script

Termux

  1. Run this command on Termux app to clone Magisk installer script into Termux ~/magiskonemu directory:
pkg install git
git clone http://github.com/huskydg/magiskonemu
  1. Run script:
  • Live mode: Run this command on Termux app to run Magisk installer script:
sh ~/magiskonemu/run.sh
  • GearLock Recovery Mode (Android x86 only): Open Virtual Terminal and type:
/data/data/com.termux/magisk/menu

Run script in GearLock Recovery Mode will always have root access.

Install Magisk into Emulator

If you want to integrate Magisk into official AVD, please patch ramdisk image using official avd_patch.sh from topjohnwu

It's difficult (still possible) to install Magisk into ramdisk image on NoxPlayer, MumuPlayer, etc... because the partition that store ramdisk does not have enough space to put magisk binaries.

So we are going to install Magisk into system partion.

  1. Go to emulator settings, enable built-in Root and reboot.

  2. Run Magisk installer script with root access

  3. Go Install/update Magisk > Select Magisk build > Install Magisk into system

  4. Go to emulator settings, disable built-in Root and reboot.

  5. Launch emulator and enjoy Magisk.

Also Read the AndnixSH's post on PlantinMods for more information if you are still confusing

Install Magisk into Bluestacks (Deprecated)

Show all
  1. You will need BSTweaker tool to Unlock the instance. The Unlock seems like Unlock bootloader on actual devices. Unlock the instance by Bluestacks Tweaker to be able to apply Magisk to system. If you don't Unlock the instance you cannot modify any thing (include ramdisk.img, system partition) in instance even with built-in root access from Bluestacks

  2. Press Patch button to provide /system/xbin/su for root

  3. Run Magisk installer script with root access

  • If you install Magisk into Ramdisk, select /dev/block/sda1 partition in Partitions Table
  1. Press UnPatch button to disable /system/xbin/su

  2. Reboot the Bluestacks instance, enjoy Magisk

IMPORTANT!! Do not Lock the instance by BSTweaker as Magisk will be wiped as well. Only do when you meet trouble with Magisk

Install Magisk into Android-x86

MagiskOnEmu is deprecated for Android-x86 project! Installing Magisk into Android-x86 is now much easier and more convenient. No need to directly patch initrd, ramdisk or system image. Please refer to initrd-magisk instead.

Show all

Install Magisk into ramdisk (RECOMMENDED)

  1. Run Magisk installer script by these way with root access or in GearLock Recovery

  2. Go Install/update Magisk > Select Magisk build > Install Magisk into ramdisk > Direct install

  • It is difficult to detect target ramdisk image so Magisk on Android x86 has to scan all partitions to find ramdisk. If the script cannot find ramdisk so you can manually choice partition and target ramdisk.
  • Then Magisk Terminal will patch ramdisk.img install Magisk into ramdisk. The old/original ramdisk.img will be backed up as ramdisk.img.bak so you can always use it to remove Magisk if you meet trouble.
  1. Remove old root method if you want Magisk work properly and hiding root.

  2. Reboot Android x86 and enjoy Magisk.

Install Magisk into system partition

Follow the installation guide above

Install Magisk by using GearLock extension (Deprecated)

This method is deprecated, please use ramdisk/initrd or system method instead!

  • If you don't have root permission: Run Magisk installer script, then go Install/update Magisk > Select Magisk build > Install Magisk by using GearLock > Export GearLock extension (GXP) and Magisk Terminal will build an extension and save it to /sdcard/Magisk. After that reboot into GearLock in Recovery Mode and install extension. Note: In Recovery Mode, the path to Internal Storage may be /data/media/0 instead of /sdcard

  • If you have Magisk installed: It's recommended to use Direct Install. Run magisk installer script, then go Install/update Magisk > Select Magisk build > Install Magisk by using GearLock > Direct Install

Important

  • This Magisk initialization cannot coexist with rusty-magisk, you need to remove rusty-magisk. If you saw /init.real in root directory, you mostly have rusty-magisk installed. To remove rusty-magisk, move /init.real to /init in ramdisk or system image (Android 10+).
  • You should not install rusty-magisk module from GearLock, it will always be removed!
  • To make Magisk work properly and able to hide, you will need to perform Remove all other Root method and your system must be writeable. For emulator, you just need to toggle off Root option in Settings.

Update

  • You can only choose one method to install Magisk, that means when you Update Magisk you must use the same method that you installed Magisk with. Do not use multiple methods to install Magisk.
  • Since Android Emulator and Android x86 usually will not have boot.img, you cannot update it through Magisk app directly. Use Magisk Terminal app to update Magisk.

Uninstall

You can remove magisk from ramdisk or system through Uninstall Magisk option of this script.

⚠️ **GitHub.com Fallback** ⚠️