[Moto G 2015 General] toxicmender:
Prerequisites:

ADB (Android Debugging Bridge) tools for your OS (Windows/Linux/Mac)

Windows: https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip

Mac: https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip

Linux: https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip

Custom Recovery Image (TWRP or some other that you prefer):

https://xdaforums.com/devdb/project/?id=11051#downloads

(Official TWRP web hosted version)https://twrp.me/motorola/motorolamotog2015.html

https://dl.twrp.me/osprey

https://eu.dl.twrp.me/osprey

USB Cable to Connect the phone to the computer

The Phone: Moto G 2015 (preferably Fully Charged)

The device drivers (for Windows and Mac): https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481

A good and active Internet Connection

An active Email address and client to quickly view it.

Installing adb and fastboot

Google hosts zips including only adb and fastboot. You can set these up for use with the instructions below.

On Windows

Download the Windows zip (Full version: https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip)(barebones version: https://dl.google.com/android/repository/platform-tools-latest-windows.zip) from Google.

Extract it somewhere - for example, %USERPROFILE%\adb-fastboot

• On Windows 7/8:

1. From the desktop, right-click My Computer and select Properties

2. In the System Properties window, click on the Advanced tab

3. In the Advanced section, click the Environment Variables button

4. In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button

5. Append ";%USERPROFILE%\adb-fastboot\platform-tools" to the end of the existing Path definition (the semi-colon separates each path entry)

• On Windows 10:

1. Open the Start menu, and type “advanced system settings”

2. Select “View advanced system settings”

3. Click on the Advanced tab

4. Open the “Environment Variables” window

5. Select the Path variable under “System Variables” and click the “Edit” button

6. Click the “Edit Text” button

7. Append ";%USERPROFILE%\adb-fastboot\platform-tools" to the end of the existing Path definition (the semi-colon separates each path entry)

• Install the device drivers linked in prerequisites (or from Motorolla support site), and reboot.

On macOS

Download the macOS zip (full version: https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip)(Barebones version: https://dl.google.com/android/repository/platform-tools-latest-darwin.zip) from Google.

Extract it somewhere - for example, ~/adb-fastboot.

Add the following to ~/.bash_profile:

if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi

Log out and back in.

On Linux

Download the Linux zip (Full version: https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip)(Barebones version: https://dl.google.com/android/repository/platform-tools-latest-linux.zip) from Google.

Extract it somewhere - for example, ~/adb-fastboot.

Add the following to ~/.profile:

if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi

Log out and back in.

You may also need to set up udev rules: see this repository (https://github.com/M0Rf30/android-udev-rules#installation) for more info.

Setting up adb

To use adb with your device, you’ll need to enable developer options and USB debugging:

1. Open Settings, and select “About”.

2. Tap on “Build number” seven times.

3. Go back, and select “Developer options”.

4. Scroll down, and check the “Android debugging” entry under “Debugging”.

5. Plug your device into your computer.

6. On the computer, open up a terminal/command prompt and type adb devices.

7. A dialog should show on your device, asking you to allow usb debugging. Check “always allow”, and choose “OK”.

Congratulations! adb is now ready to use with your device.

Unlocking the bootloader

Note: The steps below only need to be run once per device.

Warning: Unlocking the bootloader will erase all data on your device! Before
proceeding, ensure the data you would like to retain is backed up to your PC and/or
your Google account, or equivalent.

1. Make sure your computer has working fastboot and adb.

2. Enable USB debugging & OEM unlocking on your device under Settings->Developer Options. Incase you don't see Developer Options, then you need to unlock it by tapping Build Number 7 times in Settings->About Phone.

3. Get the current status of your bootloader:

Open a terminal on the PC and boot the device to fastboot mode by typing:

adb reboot bootloader

You can also boot into fastboot mode via a key combination:

• Hold Volume Down & Power simultaneously. On the next screen use Volume

Down and Volume Up to scroll and Power to select.

Once the device is in fastboot mode, verify your PC finds it by typing:

fastboot devices

If you see "no permissions fastboot" or "<waiting for device>", try running

fastboot

as root/Administrator.

From the same terminal, type the following command to get the bootloader status:

fastboot oem device-info

4. Follow the instructions at Motorola Support (https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a) to unlock your bootloader, you will need to register at this site with a working/active email to recieve the OEM unlock code.

Note: If your device is not supported by the Motorola Bootloader Unlock

website, you will need to use an alternative bootloader unlock method like

SunShine (http://theroot.ninja/index.html).

Installing a custom recovery using fastboot

1. Make sure your computer has working fastboot and adb.

2. Enable USB debugging & OEM unlocking on your device under Settings->Developer Options. Incase you don't see Developer Options, then you need to unlock it by tapping Build Number 7 times in Settings->About Phone. This needs to be done again due to resetting of your phone.

3. Download recovery - visit twrp.me to obtain the latest version of Team Win

Recovery Project for your device. Moto G 2015 does have an official TWRP recovery that you can find here: https://twrp.me/motorola/motorolamotog2015.html

4. Connect your device to your PC via USB.

5. Open a terminal on the PC and boot the device to fastboot mode by typing:

adb reboot bootloader

6. Once the device is in fastboot mode, verify your PC finds it by typing:

fastboot devices

If you see "no permissions fastboot" or "<waiting for device>" , try running

fastboot

as root/Administrator.

7. Flash recovery onto your device:

fastboot flash recovery your_recovery_img.img

This command assumes the recovery image is present in your current working directory (Check using DIR on command prompt or ls command on terminal)

If it isn't you can change your current directory to the directory containing the recovery image or copy/move the recovery image to your current working directory.

8. Now reboot into recovery to verify the installation:

• Hold Volume Down & Power simultaneously. On the next screen use Volume

Down to scroll to recovery and then use Power to select.

That's all folks. You may now root your phone, or even flash a custom ROM. I suggest getting openGapps for the custom ROM if you wish to use Google play services on the custom ROM.

Popular adb commands

adb shell

Launches a shell on the device accessed through the terminal on your computer.

adb push <local> <remote>

Pushes the file <local> to <remote>

adb pull <remote> [<local>]

Pulls the file <remote> to <local>. If <local> isn’t specified, it will pull to the current folder.

adb logcat

Allows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs, and adb logcat -C to view logs in colour

adb install <file>

Installs the given .apk file to your device

<local> refers to location on your computer (like c:\\Users\%USERPROFILE%\adb-fastboot on windows or ~/adb-fastboot on unix based OS), while <remote> refers to location on your android device (like "/sdcard/", without quotes)

Thanks to @acejavelin for helping members troubleshoot problems that they faced