Soon after the Chinese iOS code developer community, Pangu, released the jailbreaking firmware to the Apple devices, some early adopters began complaining that their devices were getting stuck during jailbreaking procedure exactly at 65%.

The Apple's devices displayed- 'Error occurred in preparing the environment, err code (51)'.

There was no official word from Pangu Team on when a fix would arrive. And just when everybody began to lose hope, the good folks at Redmond Pie have come up with a workaround, which is capable of sorting out the glitch in the jailbreaking process.

Here's how to fix - 'Error occurred in preparing the environment, err code (51)':

Disclaimer: This procedure is very technical and should be performed by a person with sound knowledge of rooting (or manual software installation) Android devices. If the step-by-step installation process is not followed properly, there are chances of the smartphone getting bricked or being permanently irreparable. IBTimes India cannot be held responsible for any damage or claims from readers if the procedure does not yield the required results or if the smartphone is bricked. Hence, users are advised to proceed with caution.

Prerequisite:

  • Make sure devices' data have been backed up individually in iCloud/iTunes or locally on PCs.

[Note: Never backup full on iTunes or iCloud because it will not be able to roll back to iOS 9.0.2. Backups created with newer versions of iOS cannot be used to restore on earlier version, reported Redmond Pie]

  • If your device is running iOS 9.1 beta version then remove [by going to Settings >> General >> Profile, then remove beta profile]

Now, let's get down fixing the glitch

Step 1: Reset the whole settings.

Go to Settings > General > Reset> Reset All

Step 2: Download and install the latest Apple iOS 9.0.2 (official) OS update (HERE)

Step 3: Once clean installing of iOS 9.0.2 is done on the Apple device, install the latest (v1.0.1) Pangu tool

Step 4: Try to jailbreak the device once again (as instructed in the tutorial below), you are more likely to finish the procedure normally this time with no error messages.

Read more: iOS 9-9.0.2 untethered jailbreak: Pangu v1.0.1 released to Apple iPhones, iPads, iPod Touch [How to jailbreak]

[Credits: Redmond Pie]