ANCS CLI: iPhone Notifications in a Linux Terminal
ancs-cli is a small Python tool for printing iPhone notifications in a Linux shell. It uses Apple’s Notification Center Service (ANCS) over Bluetooth Low Energy (BLE), with BlueZ handling Bluetooth and D-Bus communication. The project is tested on a Raspberry Pi.
How it works
The script advertises the ANCS service and waits for the iPhone to connect. Once connected, it discovers the ANCS characteristics and listens for notification events. For each new or modified notification, it requests the app name, title, subtitle, and message, then prints them with the notification category and event type.
It also reports removed notifications and marks notifications replayed from the iPhone’s Notification Center as ADDED(existing). The program runs asynchronously and waits for the iPhone to reconnect if the Bluetooth connection drops.
Run it
On a Linux machine with BlueZ and a Bluetooth LE adapter:
sudo rfkill unblock bluetooth && bluetoothctl power on
git clone https://github.com/hamzehnasajpour/ancs-cli.git
cd ancs-cli
./setup_env.sh
./run.sh
setup_env.sh creates a Python virtual environment and installs the dbus-fast dependency. The runner advertises as ANCS-Linux by default; pass a different name if you want:
./run.sh MyLinuxDevice
On the iPhone, pair with the advertised device in Settings → Bluetooth, then open its device information and enable Share System Notifications. To keep output in a log:
./run.sh > notifications.log 2>&1 &
tail -f notifications.log
A few practical details
- The iPhone must allow notifications for an app before ANCS can report them. WhatsApp and other third-party apps follow their iOS notification settings.
- The project uses the Linux BlueZ stack; it is not an Android notification bridge.
- Pairing confirmation is automatically accepted while the program runs, and the Bluetooth adapter is made discoverable. Run it in a trusted environment, stop it when you are done, and remember that terminal output or logs may contain private messages.
The appeal of this project is its directness: a single Python script connects BlueZ’s GATT interfaces to the ANCS event and attribute flow, without a desktop notification app in the middle.