This works for all Android versions including Android 4.2.1 and 4.2.2.
This rooting guide will allow you to also backup and restore your apps/settings.
Before we begin, please BACK UP EVERYTHING on your internal storage of Nexus 4 to your hard disk (you can do this by connecting it to your computer via USB cable or use AirDroid app).
This zip package contains everything you need including drivers for Windows and rooting files for all Windows, Mac, and Linux. Please download and unzip.
Step 1.Go to Settings->About Phone on your Nexus 4.
Step 2.Hit the “Build Number” couple times until your phone says, “You are now a developer”. Hit the back button.
Step 3.You will now see extra menu called “Developer options”, hit it.
Step 4.Make sure Developer options is ON and USB debugging is also checked then connect a micro-USB cable from your Nexus 4 to your computer.
Step 5.For Windows, you will need to install drivers. If you have Linux/Ubuntu or Mac OSX, skip to Step 7.
Step 6.Open Device Manager on your computer and update the Nexus 4 with exclamation mark with drivers provided in Nexus4Root.zip.
If you see something like “Android ADB Interface” you are ready for the next step.
Step 7.Open a command prompt (or terminal for Linux/Ubuntu or Mac) and type:
adb backup -apk -all -f backup.ab
chmod 755 *
./adb-linux backup -apk -all -f backup.ab
For Mac OSX:
chmod 755 *
./adb-mac backup -apk -all -f backup.ab
Step 8.Go to your phone and you should see a Pop-up window asking you if you want to backup your data, hit “Back up my data”. This will backup all of your settings, apps, app data, wifi passwords, etc…etc… It will NOT BACKUP contents of your internal storage such as your personal videos/photos (you should have done that before following this guide!!!).
Step 9.Once backup is done, go ahead and turn your Nexus 4 power off. Then hold down the Volume Down and Power buttons together for about 5 seconds.
Step 10.Once in bootloader menu, connect a micro-USB cable from your Nexus 4 to your computer.
Step 11.Open up Device Manager again, if you don’t see “Android ADB Interface” you will have to install drivers again. Repeat Step 5 to install drivers. For Ubuntu/Linux or Mac OSX, skip to Step 12, no drivers required!
Step 12.Next go back to command prompt/terminal and type:
adb oem unlock
./adb-linux oem unlock
For Mac OSX:
./adb-mac oem unlock
Step 13.Go to your Nexus 4, hit the Volume Up button to select “Yes” and hit the Power button. Then hit the Power button again to re-boot your phone
Step 14.Once re-booted, your Nexus 4 will be like the day you got it, everything wiped and starting from scratch. Go ahead and sign in.
Step 15.Connect your Nexus 4 to your computer and copy the file CWM-SuperSU-v0.99.zip to anywhere on your Nexus 4.
If you have trouble on Mac OSX connecting to your Nexus 4, download and install Android File Transfer.
Also, if you have more trouble, you can download this file with your Nexus 4′s browser at DownloadAndroidROM.com. (It will be saved in your Downloads folder btw.)
Step 16.Re-boot into the bootloader like you did in Step 9 and connect a micro-USB cable from your Nexus 4 to your computer.
Step 17.Go back to your command prompt/terminal and type:
fastboot flash recovery recovery-clockwork-touch-220.127.116.11-mako.img
./fastboot-linux flash recovery recovery-clockwork-touch-18.104.22.168-mako.img
./fastboot-mac flash recovery recovery-clockwork-touch-22.214.171.124-mako.img
Go back to your Nexus 4, choose “Recovery mode” using Volume buttons and hit the Power button.
Step 19.Once in ClockworkMod(CWM) Recovery, choose “install zip from sdcard”.
Step 20.Next, choose “choose zip from sdcard”.
Step 21.Choose “0/”.
Step 22.Choose “CWM-SuperSU-v0.99.zip” and hit “Yes”. This is the actual rooting file, which included su binaries and SuperSU app, giving your phone root. This is the only part of this tutorial that actually roots your Nexus 4. We only did all the other steps to unlock the bootloader and install CWM Recovery which allows us to install this file on our phone.
Step 23.Choose “Reboot” from the main menu, if you see the following screen, make sure to choose “Yes – Disable recovery flash”. This is so you will have permanent CWM recovery as stock Android operating system overwrites it on re-boot if you don’t say yes here.
Step 24.Once rebooted you should find an extra app in the app drawer called “SuperSU”. Congratulations! You’ve successfully rooted your Nexus 4! You can download rooted apps like Titanium Backup app (which I highly recommend you to run once) and verify you have full root.
Step 25.Now, let’s try to restore some of your settings, apps, and app data. If you did make a backup of your internal storage before you started rooting, go ahead and copy all your files back into Nexus 4 internal storage.
Next, go back to command prompt/terminal and type:
adb restore backup.ab
./adb-linux restore backup.ab
For Mac OSX:
./adb-mac restore backup.ab
Once that’s done, you should find your Nexus 4 fully restore with all of your settings, apps, app data, and your photos/videos plus rooted phone. Congrats!