Mi Unlock Tool for Mac and Linux

Mi Unlock Tool for Mac and Linux 1

Finally, while Xiaomi has not released the Mac and Linux version of its bootloader unlock tool, a third-party alternative is available. Download the unofficial version of MIUI bootloader unlocking tool from the mirror link below. This unofficial version is compatible on all computer running Windows 8/8.1/10, any Linux distros (Ubuntu, Debian, CentOS), or Apple Mac OS.

Thanks to Fransisco an XDA community member who develops the tool. He has managed to extract the core function of the official Mi Unlock Tool. He then modded the codes to make it work on Unix-based computers.

However, this does not mean you can bypass the official permission. You will still need to obtain the official permit from Xiaomi Dev Team prior using the tool.

Moreover, the Oracle Java package is also essential (JavaFX for GUI if not included in your JDK/JRE). The tool won’t work flawlessly without these dependencies.

Download Mi Unlock Tool

You can grab the file from its official link hosted on Mega.nz here. Alternatively, you may also use the mirror link below. The mirror direct link below is hosted on the US and EU servers for better redundancy. Even better, it is a direct link that supports resume-able connections. It means the process will run smoothly either on a computer or an Android device.

File name :
Version n/a | 38790 downloads | Size: 5 MB

Nerdy FYI

You don’t have to understand how the stuff behind the tool works. However, you may find it interesting once you knew and how this tool is made possible.

The developer who shares this tool learned the mechanism of MIUI bootloader unlocking process. He explained that the original Mi Flash Unlock tool (for Windows) acts as a bridge between Xioami server, fastboot, and you with your Mi Account credentials. The actual part that conducts the unlocking task is actually fastboot.

The Mi Flash Unlock tool needs to fetch your device information. Next, it sends the information to the Xiaomi server with the account login token. Once received, the server checks whether all requirements are fulfilled. The requirements include whether the account has been authorized, whether the account associated (Mi Account binding) with the device in the Developer Settings and so on.

Once the server feels all the requirements are satisfied, it will reply back with the unlock key for your device instance. This instance key always changes everytime you reboot the phone.

The Mi Flash Unlock tool will then send the key to the device with a custom build of fastboot. Here’s then the magic happens: If the key is correct, the device bootloader will be unlocked. Otherwise, it will reboot.

ALSO READ:  TWRP Installer and Magisk Root for Redmi Note 7 Pro (Codename Violet)

All such nerdy stuff has encouraged Fransisco to create such a tool. He realizes that if he can replicate the mechanism, there is a possibility to do the mechanism on a Unix-based computer.

Check also: Mi Account Authorization Tips: Check and Apply for it!

How to use

First thing first, you need to unzip/extract the actual tool. Moreover, make sure you have already had Java installed.

On Linux:

  1. Open a terminal window.
  2. Go to the extracted directory using cd command.
  3. Use this command “sudo ./MiUnlockTool.sh” for the GUI-based interface or “sudo ./MiUnlockTool.sh username password” for command-line interface.

On Apple Mac:

You just need to open (double click) the MiFlashUnlock.command file.

Alternatively, you can also do this on Terminal.

  1. Open the terminal window
  2. Go to the extracted directory using the cd command.
  3. Issue this command “./MiFlashUnlock.command username password“.
  4. Reboot your phone into the Fastboot mode.
  5. Connect your device with your Mac.

If you are using the command line version remember that there is no confirmation request before the unlocking process and there is no check if the bootloader is already unlocked.

Check also: How to unlock MIUI Bootloader on Windows.

Yeah, I know! It is not as simple as its Windows version. Since you are using Linux (or Mac), I assume you already understand the consequences, including the need to be a geek.

Here are some possible errors that might happen:

  • Problem: A permission related error on Linux or Mac when launching the tool.
    Workaround: Open the terminal and cd into the extracted directory. Next, use “chmod 777 MiUnlockTool.sh” on Linux or “chmod 777 MiUnlockTool.command” on Mac. This command is crucial to set the executable permission.
  • Problem: The device isn’t recognized properly by your computer.
    Workaround: Simply try re-launching the tool with sudo (sudo ./MiUnlockTool.sh on Linux, or sudo ./MiUnlockTool.command on a Mac)
  • Problem: Other errors when launching the tool.
    Workaround: Try issuing this command “java -jar bin/MiUnlockTool.jar“.
  • Problem: Errors with JavaFX class not found when you try to launch the GUI.
    Workaround: You are missing the JavaFX library. See openjfx package on Linux.

Our Verdict

Despite some users found the tool quite messy, we think it is a useful tool still. At least it provides possibilities for Linux and Mac users to unlock the MIUI bootloader of their phones without the need to find a Windows PC.


18 thoughts on “Mi Unlock Tool for Mac and Linux”

  1. MiFlashUnlock.command should be MiUnlockTool.command.
    On OSX I keep getting this error in the terminal:

    [20:39:47][ERROR ] Login procedure failed, please check your login credentials
    [20:39:47][ERROR ] Login exception: Login return code is not zero: 70016 (Login error)

    Pretty sure I use the correct Mi account credentials.
    Any idea?

  2. MiUnlockTool.sh: 2: [: Illegal number:
    Exception in thread “main” java.lang.NoClassDefFoundError: javafx/application/Application
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at com.xiaomitool.miunlock.Main.main(SourceFile:46)
    Caused by: java.lang.ClassNotFoundException: javafx.application.Application
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    … 10 more

    1. I had some issues too using the Mi Unlock Tool for Linux (error code 20041) so I used the official Win unlock tool in a virtual machine. It turned out that the issue behind the error code 20041 was for me, that Xaomi wanted my phone number. I had to add my phone number as the backup phone number in my MI account. Then the official tool stopped with an error telling me to try it again in 166 hours. The Mi Unlock Tool for Linux stopped now with the error code 20036.
      After a google research i gave up my hopes to accelerate the wait time.

      Mission to be continued next week.

  3. I had this error:
    [06:55:33][INFO ] Starting login procedure
    [06:55:52][INFO ] Login procedure succeeded
    [06:55:52][INFO ] Checking account unlock permission
    [06:55:54][INFO ] Unlock permission confirmed
    [06:55:54][INFO ] Waiting for a fastboot device
    [07:00:01][INFO ] Device connected: fff4daea
    [07:00:01][INFO ] Obtaining device info…
    [07:00:01][ERROR ] Error during device info retrieval: Unable to get device token
    [07:00:01][INFO ] Device info obtained
    [07:00:01][INFO ] Checking if unlock will erase data and server message
    [07:00:05][INFO ] Unlock procedure will not erase userdata
    [07:00:05][INFO ] Server message: An unlocked device is an easy target for malware which may damage your device or cause financial loss.
    [07:00:05][INFO ] Querying unlock server for unlock key
    [07:00:07][ERROR ] Unlock request replied with error code 10000
    [07:00:07][ERROR ] Error meaning: Request parameter error

    Could you please help me?

  4. [15:22:30][INFO ] Starting login procedure
    [15:22:33][INFO ] Login procedure succeeded
    [15:22:33][INFO ] Checking account unlock permission
    [15:22:34][INFO ] Unlock permission confirmed
    [15:22:34][INFO ] Waiting for a fastboot device
    [15:24:10][INFO ] Device connected: d86a90b1
    [15:24:10][INFO ] Obtaining device info…
    I’m still waiting too long time this step.
    It seems won’t continue.
    Any help ?

  5. [17:35:21][INFO ] Server message: The version of your tool is low and there may be a security risk. Please upgrade it right now!
    [17:35:21][INFO ] Querying unlock server for unlock key
    [17:35:28][ERROR ] Unlock request replied with error code 20035
    [17:35:28][ERROR ] Error meaning: Please download the latest version

  6. Would you please tell why the tool is obfuscated, and where to find its source code ?

    And, finally, it does not work as February 2022 – shows 401 Unauthorized, or keeps loading infinitely on QR-code login

Leave a Reply

Your email address will not be published.