Files
pidcat-repl/README.md
T

92 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2026-07-20 09:43:26 -04:00
PID Cat REPL
============
2013-06-11 22:59:50 -07:00
2026-07-20 09:43:26 -04:00
A fork of [JakeWharton/pidcat][5], which is itself an update to Jeff Sharkey's
excellent [logcat color script][1]. Both filter `adb logcat` down to the log
entries for a specific application package; this fork adds an interactive,
full-screen filter UI on top, turning `pidcat` into more of a REPL than a
one-shot stream.
2013-06-11 22:59:50 -07:00
2026-07-20 11:44:13 -04:00
Install
-------
Use [Homebrew][2]:
```shell
brew tap imcarlost/pidcat-repl
brew trust imcarlost/pidcat-repl
brew install pidcat-repl
```
Background
----------
2013-06-11 22:59:50 -07:00
During application development you often want to only display log messages
coming from your app. Unfortunately, because the process ID changes every time
you deploy to the phone it becomes a challenge to grep for the right thing.
This script solves that problem by filtering by application package. Supply the
2013-06-11 23:30:21 -07:00
target package as the sole argument to the python script and enjoy a more
2013-06-11 22:59:50 -07:00
convenient development process.
2014-03-11 20:21:19 -07:00
pidcat com.oprah.bees.android
2013-06-11 22:59:50 -07:00
2026-07-20 09:43:26 -04:00
If you just want the original, non-interactive `pidcat`, use the upstream
[JakeWharton/pidcat][5] project or pass `--plain` here, see [Interactive
mode](#interactive-mode) below.
2013-06-11 22:59:50 -07:00
2013-06-11 23:17:08 -07:00
Here is an example of the output when running for the Google Plus app:
2013-06-11 22:59:50 -07:00
![Example screen](screen.png)
Interactive mode
-----------------
When both stdin and stdout are a terminal, `pidcat` opens a full-screen filter
UI instead of streaming: logs render above a bottom prompt line, and whatever
you type live-filters the scrollback to lines containing every typed word,
case-insensitively.
* `Backspace` edits the query, `Ctrl-U` clears it.
* `Ctrl-L` forces a redraw; the view also tracks terminal resizes.
2026-07-20 11:44:13 -04:00
* `Esc` or `Ctrl-D` quits and restores your scrollback.
Pass `--plain` to get the original streaming output instead, e.g. for
`pidcat --plain com.oprah.bees.android | grep Foo`. Piped input or output
(`adb logcat | pidcat com.oprah.bees.android`, `pidcat ... | less`) always
uses plain streaming, since there is no terminal to draw the UI on.
2026-07-20 11:44:13 -04:00
Requirements
------------
2014-03-11 20:21:19 -07:00
2014-03-11 22:45:41 -07:00
Make sure that `adb` from the [Android SDK][3] is on your PATH. This script will
not work unless this is that case. That means, when you type `adb` and press
enter into your terminal something actually happens.
2014-03-12 11:51:27 -04:00
To include `adb` and other android tools on your path:
2014-03-13 07:45:54 +01:00
export PATH=$PATH:<path to Android SDK>/platform-tools
2014-03-12 11:51:27 -04:00
export PATH=$PATH:<path to Android SDK>/tools
Include these lines in your `.bashrc` or `.zshrc`.
2013-06-11 22:59:50 -07:00
*Note:* `<path to Android SDK>` should be absolute and not relative.
2013-06-11 22:59:50 -07:00
`pidcat` requires at least version 8.30 of `coreutils`. Ubuntu 20.04 LTS already ships
with it, for 18.04 and below, `coreutils` can be upgraded from the `focal` repo by running
the following:
```shell
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse'
sudo apt-get update
sudo apt-get -t focal install coreutils
```
2013-06-11 23:17:08 -07:00
[1]: http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/
2014-03-11 20:21:19 -07:00
[2]: http://brew.sh
2014-03-11 22:45:41 -07:00
[3]: http://developer.android.com/sdk/
2026-07-20 09:43:26 -04:00
[5]: https://github.com/JakeWharton/pidcat