adb-shell-pm
Manage Android packages
TLDR
List installed packages
Install an app package from a given path
Uninstall a package from the device
Clear all app data for a package
Enable a package or component
Disable a package or component
Grant a permission for an app
Revoke a permission for an app
SYNOPSIS
adb shell pm <subcommand> [options] [arguments]
PARAMETERS
list [-3 -f -d -e -i -s -u --user USER_ID] [FILTER]
Lists packages: system(-s), enabled(-e), disabled(-d), third-party(-3), with paths(-f), installer(-i), uninstalled(-u)
path PACKAGE
Prints APK path for given package
install [-r -t -g -d -a -p -f -D -l -s -u --incremental] PACKAGE
Installs APK: replace(-r), test(-t), grant all perms(-g), downgrade(-d), all users(-a), partial(-p), force(-f), etc.
uninstall [-k] PACKAGE
Uninstalls package, keep data/cache(-k)
clear PACKAGE
Clears all data for app
enable PACKAGE_OR_COMPONENT [--user USER_ID]
Enables package or component
disable [-user USER_ID] PACKAGE_OR_COMPONENT
Disables package or component
grant PACKAGE permission
Grants runtime permission to package
revoke PACKAGE permission
Revokes runtime permission from package
dump PACKAGE_OR_UID
Dumps detailed package info
set-installer PACKAGE installer
Sets package installer package name
get-install-location
Returns current install location
DESCRIPTION
The adb shell pm command invokes the Android Package Manager (pm) on a connected Android device through the Android Debug Bridge (ADB). ADB is a versatile command-line tool from the Android SDK that facilitates communication between a host computer and Android devices or emulators.
Package Manager handles core operations on apps and components, including installing APKs, uninstalling packages, listing installed apps, clearing app data, enabling/disabling packages or components, granting/revoking permissions, and querying package details. It is indispensable for developers, testers, and power users managing apps programmatically without relying on the device's GUI.
Usage requires USB debugging enabled on the device, ADB installed on the host (Linux, macOS, Windows), and a connected device via USB or TCP/IP. Commands execute in the device's shell environment, respecting user permissions and system policies. Many operations require no root access, but some advanced features like moving apps to external storage may need elevated privileges.
Common workflows include bulk package management, debugging app states, preparing devices for testing, or scripting deployments. Output is typically concise, with options for filtering and formatting.
CAVEATS
Requires ADB setup, USB debugging enabled, and authorized device. Some commands fail without shell root. Not for production; use cautiously to avoid data loss. Android version affects option availability.
EXAMPLES
List all packages:
adb shell pm list packages
Install APK:
adb shell pm install /sdcard/app.apk
Clear app data:
adb shell pm clear com.example.app
REQUIREMENTS
Android SDK platform-tools installed. Run adb devices to verify connection.
HISTORY
Introduced with Android 1.0 (2008) as part of AOSP platform-tools. Evolved with Android features like multi-user support (Android 4.2), permissions model (Android 6.0), and scoped storage (Android 10+). ADB/pm remain core developer tools.
SEE ALSO
adb(1)


