Installing on macOS

Installing Homebrew for macOS

The simplest way to install the WiFi Coconut tools for macOS is to install the Homebrew package manager.

The Homebrew package manager is available at https://brew.sh/

If you are not already using Homebrew, follow the install directions on the Homebrew site.

If prompted to install the Xcode Command Line tools, do so. They will be required!

Install the WiFi Coconut tools

Once Brew and the Xcode command line tools are installed, installing the WiFi Coconut tools for macOS is as simple as:

brew tap hak5/wifi-coconut
brew install wifi-coconut

This will download and install the WiFi Coconut tools, compile them automatically, and install them.

If prompted to install other tools such as the xcode command-line tools, do so.

Example installation

hak5 ~ % brew install wifi-coconut
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:2af9bce
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://github.com/hak5/hak5-wifi-coconut/archive/refs/tags/v1.0
Already downloaded: /Users/hak5/Library/Caches/Homebrew/downloads/401dc2d1ee3da1d0831be9a6783966a7b6eb3944daf8db1c660a36aed086ea5c--hak5-wifi-coconut-1.0.0.tar.gz
==> Installing wifi-coconut from hak5/wifi-coconut
==> Installing dependencies for hak5/wifi-coconut/wifi-coconut: pkg-config
==> Installing hak5/wifi-coconut/wifi-coconut dependency: pkg-config
==> Pouring pkg-config--0.29.2_3.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pkg-config/0.29.2_3: 11 files, 676.4KB
==> Installing hak5/wifi-coconut/wifi-coconut
==> echo $(pwd)
==> cmake -S ../
==> make
==> make install
🍺  /opt/homebrew/Cellar/wifi-coconut/1.0.0: 9 files, 349.0KB, built in 4 seconds
==> Running `brew cleanup wifi-coconut`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
hak5 ~ %

Running

The wifi_coconut tool is the main interface for the WiFi Coconut, run it from a terminal with:

wifi_coconut

Additionally, the wifi_coconut tool takes several options to automate behavior:

Usage: wifi_coconut [options]
By default, the wifi_coconut tool opens in interactive mode.
Universal options:
 --disable-leds        Go fully dark; don't enable any LEDs
 --invert-leds         Normally a Wi-Fi Coconut enables all the LEDs
                       and blinks during traffic; Invert only lights
                       when there is traffic.
 --disable-blinking    Disable blinking the LEDs on traffic
 
Non-interactive modes:
 --no-display          Don't display channel UI while logging
 --wait                Wait for a coconut to be found
 --pcap=[fname]        Log packets to a pcap file.  If file is '-',
                       a pcap file will be echoed to stdout so that it can
                       be piped to other tools. --wait-for-coconut    Wait for a coconut to be connected and identified
 --list-coconuts       List Wi-Fi Coconut devices and exit
 --coconut-device=X    If you have multiple Wi-Fi Coconuts, specify
                       which one to use
 --enable-partial      Enable a Wi-Fi Coconut even if not all the
                       radios have been identified.
 --plain-dot11         Log plain 802.11 packets instead of radiotap
                       formatted packets with signal and channel
 --quiet               Disable most output

Warning - if you are using an older macOS (Catalina or Big Sur), there is a known bug in the macOS kernel for handling USB. You will need to exit all other applications that may interact with the USB system, including browsers such as Chrome.

This has been fixed in more recent macOS releases and is no longer a problem with Monterrey and newer! It is also not a problem on macOS versions earlier than Catalina.

Integrating with other tools

Output from the wifi_coconut tool can be directly piped to other tools like tcpdump or tshark:

sudo wifi_coconut --no-display --pcap=- | tcpdump -r -

or

sudo wifi_coconut --no-display --pcap=- | tshark -r -

Compiling from source

You can, of course, compile the WiFi Coconut tools manually.

Install dependencies

To compile from source on macOS you will need:

  • The Xcode command line tools from Apple

  • The CMake build system

  • Git

  • LibUSB 1.0.0

In the Homebrew package manager, these can be installed by installing Homebrew, then installing dependencies:

brew install cmake
brew install libusb

For other package managers, you will need to install the equivalent packages.

Check out the code

git checkout https://github.com/hak5/hak5-wifi-coconut

Configure

cd hak5-wifi-coconut
mkdir build
cd build
cmake ../

cmake will confirm that the required dependencies are available.

Compile

make

Install

make install

This will install the wifi-coconut tool to the default path (/usr/local/bin by default), and the rt2800usb firmware to /usr/local/share/.

Last updated