libcec is the software that powers the Pulse-Eight USB-CEC Adapter. It is supported on macOS, allowing Mac users to control their TV over HDMI using the USB-CEC Adapter. This article covers installation via MacPorts (recommended) and building from source.
Method 1 — Install via MacPorts (Recommended)
libcec is available through MacPorts, which is the simplest installation method and does not require compiling from source.
If you have MacPorts installed, libcec can be installed with a single command in Terminal:
sudo port install libcec
If you do not have MacPorts installed, download and install it from macports.org first, then run the command above.
Method 2 — Build from Source
Building from source gives you the latest version of libcec and works on all supported macOS versions.
Prerequisites
You will need the following before compiling:
- p8-platform 2.0 or later — github.com/Pulse-Eight/platform
- cmake 2.6 or later — install via MacPorts (
sudo port install cmake) or cmake.org - Xcode 3.2.6 or later with C++11 support (C++11 support was added in OS X 10.9)
- Optional: Python 3.4 or later and Swig to generate Python bindings
- Optional: libX11 and xrandr to read the sink's EDID, used to determine the PC's HDMI physical address
Compilation Steps
Open Terminal and run the following commands:
git clone https://github.com/Pulse-Eight/libcec.git mkdir libcec/build cd libcec/build cmake .. make sudo make install
pkg.m4 to your m4 sources directory if the cmake step reports it cannot find pkg-config macros.Testing the Installation
With the USB-CEC Adapter connected and your TV powered on, open Terminal and run:
cec-client -l
This lists detected CEC adapters. You should see the Pulse-Eight adapter listed. To scan the CEC network and see all connected devices:
echo "scan" | cec-client -s -d 1
Common Commands
Turn TV on:
echo "on 0" | cec-client -s -d 1
Turn TV off / standby:
echo "standby 0" | cec-client -s -d 1
Monitor all CEC traffic (useful for troubleshooting):
cec-client -m
Press Ctrl+C to stop. See: CEC Adapter — Monitoring Mode
4K Resolution Note
If you are using the adapter in-line at 4K resolution and experiencing signal issues, see: USB-CEC Adapter — 4K Resolution for the two-cable workaround.
libcec source and documentation: github.com/Pulse-Eight/libcec
Email: cs@pulse-eight.com | Submit a support ticket
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article