Wasm-opt Installation On A Debian, Ubuntu, Alpine, Kali And MacOS

Wasm-opt Installation On A Debian, Ubuntu, Alpine, Kali And MacOS

wasm-opt

Optimize WebAssembly binary files.

Maintainer: Markus Koschany



Section: devel

Install wasm-opt

  • Debian apt-get install binaryen Click to copy
  • Ubuntu apt-get install binaryen Click to copy
  • Alpine OS apk add binaryen Click to copy
  • Kali Linux apt-get install binaryen Click to copy
  • macOS brew install binaryen Click to copy

Optimize WebAssembly binary files.

How to use wasm-opt?

Below are few example commands for wasm-opt that you can use in the terminal.

Apply default optimizations and write to a given file:
wasm-opt -O input.wasm -o output.wasmClick to copy
Apply all optimizations and write to a given file (takes more time, but generates optimal code):
wasm-opt -O4 input.wasm -o output.wasmClick to copy
Optimize a file for size:
wasm-opt -Oz input.wasm -o output.wasmClick to copy
Print the textual representation of the binary to console:
wasm-opt input.wasm --printClick to copy
To install the latest version of wasm-opt in your favorite operating system just copy the wasm-opt installation command from above and paste it into terminal. It will download and install the latest version of wasm-opt 2026 package in your OS.