Last Updated: January 06, 2019
·
1.736K
· skyzyx

Install WebP CLI tools on Mac/Linux

Homebrew has a very incomplete installation of WebP binaries. This is something you can add to your project Makefile for compiling WebP on Mac/Linux. You will need the Xcode CLI Tools (not all of Xcode itself), and install Homebrew so that you can do:

brew install cmake wget

Here is the Makefile entry:

WEBP_VERSION="1.0.1"

.PHONY: build-webp
build-webp:
    wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$(WEBP_VERSION).tar.gz -O /tmp/libwebp-$(WEBP_VERSION).tar.gz
    tar -C /tmp -zxvf /tmp/libwebp-$(WEBP_VERSION).tar.gz
    mkdir -p /tmp/libwebp-$(WEBP_VERSION)/build
    cd /tmp/libwebp-$(WEBP_VERSION)/build && \
        cmake -DWEBP_ENABLE_SIMD=ON -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON -DWEBP_BUILD_GIF2WEBP=ON -DWEBP_BUILD_IMG2WEBP=ON -DWEBP_BUILD_WEBPINFO=ON -DWEBP_NEAR_LOSSLESS=ON ../ \
        make && make install

This will give you: cwebp, dwebp, get_disto, gif2webp, img2webp, vwebp, webp_quality, webpinfo, webpmux.

You can find the latest release versions at https://github.com/webmproject/libwebp/releases.