Installing Cyanogenmod and XPrivacy on a Stock Nexus 5

This is a step-by-step guide for replacing Lollipop 5.1.1 with Cyanogenmod and XPrivacy on a stock Nexus 5.

Do you want to learn more about your phone and control access to your personal data? Those are a couple of reasons to wipe the stock Android operating system and replace it with Cyanogenmod and XPrivacy. Both are transparently developed, open-source software.

The pre-installed Android operating system provides no functionality for restricting specific app permissions. When you install an app from the Playstore, you either grant it all the access it asks for, or cancel the installation.

With XPrivacy you can block applications from accessing sensitive information such as your contact list, text messages or location.

If you run into unexpected problems or would like more information, search the forums at Cyanogenmod or XDA-Developers (the group behind the Xposed Framework, XPrivacy and other cool open-source Android projects)

3. Gapps (Optional): Due to licensing restrictions, Google Apps (YouTube, Hangouts, Google Play, etc.) cannot be included in Cyanogenmod. They must be installed separately. Download them from The Open GApps Project. I chose to download the pico variant to reduce bloat. It includes only Google Play, which all other Google Apps can be downloaded from. The md5sum can be found at the bottom of the page.

Install Custom Recovery

After setup completes, the phone will have returned to default settings. You need to re-enable developer options and USB debugging to communicate with the phone via USB (See step three).

*** At this point, copy all the files downloaded in step one to a directory on the device (E.g. The Download directory). The Cyanogenmod, Gapps, and Xposed Framework files should all remain in their .zip format (do not extract).

Issue the command adb reboot bootloader to reboot the phone into fastboot mode.

Verify that the computer can see the device by typing fastboot devices.

Flash the TWRP recovery ROM to the phone by issuing the following command:

fastboot flash recovery TWRP_recovery_file.img

Where TWRP_recovery_file.img is the name of the TWRP img file you downloaded in step one.

Flashing TWRP Recovery

After it has finished, power down the phone by selecting “Power off” from the fastboot menu (use volume buttons and power button to select).

After powering off, hold both the volume down and power button until the phone enters fastboot mode (takes about five seconds). See more specific advice at phoneArena.

Navigate to “Recovery mode” with the volume keys and press the power button to select it. The phone should launch the TWRP recovery program:

Flash Cyanogenmod, Gapps (optional), and Xposed Framework

First, tap the “Wipe” button and swipe where it says “Swipe to Factory Reset”.

Go back to the main menu and tap the “Install” button

Navigate to the directory where you stored the Cyanogenmod .zip file and select it. Now tap “Add More Zips”, locate the Gapps .zip and select it. Tap “Add More Zips” again, locate and select Xposed Framework zip. You can flash all three in a row this way.

Check “zip signature verification”, which will verify that the files have been signed by the developers.

Finally, swipe where it says “Swipe to Confirm Flash” and all three zips will be flashed in sequence.

After successful completion, tap “Reboot”. Wait as Cyanogenmod configures the system and optimizes all applications.

Complete the initial setup.

Root the Phone

We need root access to the phone in order to install the Xposed Framework and XPrivacy application.

Go into Settings -> About Phone -> tap build number rapidly until the developer options become available.