How to gain root on BlueStacks Android emulator BlueStacks is a popular Android emulator for Windows and macOS for gamers. It is popular, because the emulator ships with Google Play Store pre-installed and installing any games is easy. Unfortunately, the emulator file system is not rooted by default. How to root it?
These instructions require that you understand the UNIX command line basics. The instructions work on OSX, Linux and Windows. No Microsoft Windows or BlueStacks Tweaker needed.

The emulator is internally using VirtualBox and runs Android x64 binaries (64 bit). It ships with two VirtualBox VDI disk images, Prebundled.bdi and Root.vdi. Luckily BlueStacks has left a primitive su binary on the disk image, so we do not need to add this binary to the image ourselves. We still need to change VirtualBox settings, though.

adb command can be obtained from Android Studio SDK by Google or it is also found in /Applications/BlueStacks.app/Contents/MacOS/adb.

Make sure that the emulator is off and turn all disks in VirtualBox configuration file to read-write. On macOS, the file can be found ~/Library/BlueStacks/Android/Android.vbox. Make sure the emulator is not running when you edit this file.



Start the emulator.

Enable ADB bridge in the emulator settings.



Download SuperSU zip file on your local computer.

Start your ADB hacking session.



# This is the default port exposed by BlueStacks
adb connect localhost:5555


Push the zip file to the /mnt/sdcard of the emulated device.



adb push SuperSU-v2.82-201705271822.zip /mnt/sdcard


Then work inside the emulator shell:



# Start shell session in the emulator VM
adb shell




# Use the provided BlueStacks binary to switch to root  
system/xbin/bstk/su

# Disable SELinux
setenforce 0

# Remount all filesystems
mount -o rw,remount,rw /
mount -o rw,remount,rw /system
mount -o rw,remount,exec,rw /storage/emulated

# Unzip SuperSU zip
cd /mnt/sdcard
mkdir supersu
cd supersu
unzip ../SuperSU-v2.82-201705271822.zip

# Extract su command and run its post-install
cp x64/su /system/xbin/su 
chmod a+rwx /system/xbin/su 
/system/xbin/su --install

# Start su daemon mode
/system/xbin/su --daemon


Now run the installer for Superuser.apk in the emulator through Media Manager.





When su --daemon is running SuperSU Android UI should detect the root when started:



The emulator needs to be restarted after this as it hangs. After the restart, when opening SuperSU you see it is enabled.