1

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?

2

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.

enter image description here

Start the emulator.

Enable ADB bridge in the emulator settings.

enter image description here

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.

enter image description here

enter image description here

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

enter image description here

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

enter image description here

| improve this answer | |
  • A few changes: 1. When editing ~/Library/BlueStacks/Android/Android.vbox, the BlueStacks should not be running. Make the edits, then start BlueStacks. 2. Start the emulator shell using adb shell – Bao Thien Ngo May 25 at 8:47
  • @BaoThienNgo Thanks. Updated. – Mikko Ohtamaa May 25 at 9:36
  • I got this error cp: /system/xbin/su: Read-only file system when I ran cp x64/su /system/xbin/su. i followed all of the steps up to that point. How can I fix this? – Tabulate Jul 25 at 1:00
  • Some of the earlier steps have failed and Virtualbox did not mount the disk in write mode. – Mikko Ohtamaa Jul 27 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.