[Nexus 4 Q&A, Help & Troubleshooting] Jubakuba:
Post One: Unlocking and Rooting

Post Two: Installing Roms / Kernels / Tweaks

Post Three: Panic Section / FAQ / Miscellaneous

Unlocking The Bootloader And Obtaining Root

*This part of the tutorial is geared towards Windows users. The MAC instructions are very similar, from what I understand. Install the package the same way. All ADB/Fastboot commands may need to start with "adb-mac" (no quotes) rather than "adb" (no quotes). Due to the vast amount of Linux distros available; instructions will vary for your device. Once ADB/Fastboot are set up all command will begin with "./adb" (no quotes) rather than "adb" (no quotes). Once ADB/Fastboot are set up; this guide is relevant to everyone.*

Time required:

20-40 minutes.

Setting up ADB for our device:

Download the AndroidSDK onto your computer.

Note: Google changes their mind every other week as to if this will be distributed as a .zip or an .exe. If you get an .zip file, simply extract the contents to your C:\ drive. For an .exe install it like you would any other program, but set the path directly to the C:\ drive when the installer asks.

Or...you can use this page to download the "ADB for Dummies AIO App."

This will automatically install ADB for you to your C:\ directory. It's very very simple this way.

If your platform-tools folder doesn't have a fastboot.exe, place this fastboot.exe file in your C:\android-sdk-windows\platform-tools (or possibly simply called tools, if you set up ADB ages ago) folder.

Now you have ADB installed! Congratulations.

Unlocking the Bootloader:

***NOTE***

This will perform a factory reset on your device. You will lose all applications. Even the data on your SD Card! I'd recommend making a Backup to your computer BEFORE performing this. There is a method for backing your data up, detailed HERE.

For the time being, there is a method available that will allow you to unlock your device (and root it) without losing your data.

For instructions, click HERE. Please note: this is a hack and isn't the "conventional" and "accepted" way of unlocking your bootloader on a nexus device. The wipe requirement is there for your safety, really, and I'm certain this will be patched in the upcoming releases.

Get the drivers:

Uninstall any previously attempted drivers if they don't work and move to the next.

Option One:

Navigate to the "Device Manager" (Control Panel > Device Manager) in Windows and Select the android device. Open the properties and select the "Install Driver" option. Pick the driver with "Install from disk." Ignore any warnings about the driver not being signed properly.

PDAnet's drivers may work if the above options don't. Simply install PDAnet (after uninstalling any previous attempted driver installations) to get the drivers.

While that is downloading, on your Nexus 4: turn USB debugging on.

To do so; you must first go to Settings>About>Build Number and click seven times.

The actual setting can then be found in Settings>Developer Options>USB Debugging

Once the drivers are installed, navigate to the C:\android-sdk-windows\platform-tools folder on your computer.

Hold shift and right click. Select "Open Command Window Here."

Plug your phone into the computer. Now in this command window type:

adb reboot bootloader

(Hit Enter)

Your phone should now boot into a screen with a green android with his chest exposed.

Type this:

fastboot oem unlock

(Hit Enter)

If your Command Prompt displays the message "waiting for device" your driver wasn't successfully installed.

Close the Command Prompt window and open Device manager while your phone is still plugged in. (Search for it using the search option).

Right Click the "Android" option and select Update Driver. Choose to "Browse My Computer" and "Let Me Pick From A List." Pick the Driver with the newest date and install it. Now retry the code above.

Your phone will ask if you want to unlock it. Select "Yes" by using the volume keys and use power to select it.

Now, navigate to "Recovery Mode" with the volume keys. Use power to select.

A screen with another Android will pop up. Press Volume Up and Power at the same time.

Select Factory Reset. This process may take a few minutes. Be patient and let it work.

Once finished, select "Reboot."

Your phone is now unlocked!

Obtaining Root Access and Custom Recovery:

Turn on USB Debugging.

To do so; you must first go to Settings>About>Build Number and click seven times.

The actual setting can then be found in Settings>Developer Options>USB Debugging

Download the following:

SuperSU (CWM .zip)

CWM (Pick the version for your device)

Place the recovery-clockwork-VERSIONNUMBER-mako.img file into your C:\android-sdk-windows\platform-tools folder.

Put the SuperSU.zip on your phone.

Open another Command Prompt if it isn't still open. (Navigate to C:\android-sdk-windows\platform-tools and shift + right click. Select "Open Command Window Here.")

With your phone plugged in type:

adb reboot bootloader

(Hit Enter)

And wait for your phone to boot into the android again.

Now type:

fastboot flash recovery IMAGENAME.img

(Change the file name to the correct file name and Hit Enter)

Once that is finished: select the "Recovery Mode" option again on your phone.

You should get a new recovery menu here. Select "install zip from sd card" and "choose zip from sd card."

Find the SuperSU.zip that you transferred earlier and select "Yes" to installing.

Navigate back to "Reboot" and reboot your phone.

You're now rooted!

However, ClockworkMod Recovery won't continue to load after this.

To fix this, find "Rom Manager" from the market. (The free version is fine.) Use the "Flash ClockworkMod Recovery" option.

If your recovery still doesn't stick around after a reboot, you have another couple options. Find a file explorer that allows root access, such as Root Explorer. Use this program to rename /system/etc/install-recovery.sh to /system/etc/install-recovery.bak. You'll need to mount the system as r/w to do this. Root Explorer provides a button at the top to do so.

Or, you can do this completely manually by firing up ADB again and running a few commands:

adb shell

(Hit Enter)

su

(Hit Enter)

mount -o remount,rw -t ext4 /dev/block/mmcblk0p1 /system

(Hit Enter)

mv /system/etc/install-recovery.sh /system/etc/install-recovery.bak

(Hit Enter)

Congratulations!

Your phone is now unlocked, rooted, and has a custom recovery!

Continue reading the next posts for info on getting custom roms, kernels, tweaks, and more!

***I take no responsibility for what happens to your phone due to following this guide! That being said, not only am I sure you'll be fine...but there are an endless amount of users who would be glad to help if you need it.***

Thanks:

Google, for making Android a reality.

VanillaTbone, for the ADB AIO app.

Efrant, for posting about a bootloader locking utility without USB.

ClockworkMod team, for being a part of making our phones as awesome as they are.

The assorted developers, who continue to push out amazing material for us to use.

The awesome community, for endlessly supporting both Android itself and its users.