LinuxCommandLibrary

gleam

Run Erlang-based concurrent programs

TLDR

Create a new gleam project

$ gleam new [project_name]
copy

Build and run a gleam project
$ gleam run
copy

Build the project
$ gleam build
copy

Run a project for a particular platform and runtime
$ gleam run --target [platform] --runtime [runtime]
copy

Add a hex dependency to your project
$ gleam add [dependency_name]
copy

Run project tests
$ gleam test
copy

Format source code
$ gleam format
copy

Type check the project
$ gleam check
copy

SYNOPSIS

gleam [--verbose] [--target <erlang|javascript>] [--message-format <plain|pretty|json>] <SUBCOMMAND> [<ARGS>]

PARAMETERS

-V, --version
    Print the Gleam version

-v, --verbose
    Enable verbose logging

--target <TARGET>
    Compilation target (<erlang> [default] or <javascript>)

--message-format <FORMAT>
    Diagnostic format: <plain>, <pretty> [default], <json>

--help
    Print help information

DESCRIPTION

Gleam is a statically typed language designed for building reliable, concurrent software. It compiles to clean Erlang bytecode for the BEAM VM—known for fault-tolerance and massive scalability—or to efficient JavaScript for browsers and Node.js. The gleam CLI manages the full development workflow: scaffolding projects, type-checking, compiling, running, formatting, testing, documenting, and publishing packages to hex.pm.

Gleam's syntax is simple and approachable, inspired by Rust and OCaml, with powerful pattern matching, modules, and a friendly type inference system. No runtime errors from type mismatches, nulls, or divisions by zero. Incremental compilation ensures fast feedback loops. Deploy BEAM apps with minimal Erlang runtime or JS bundles for web.

Perfect for APIs, CLI tools, and distributed systems. Supports OTP integration for advanced concurrency.

CAVEATS

Not in standard Linux distro repos; install via script or brew/chocolatey. Erlang target needs OTP 24+; JavaScript needs Node.js 18+. No runtime deps for BEAM beyond minimal Erlang.

INSTALLATION

Unix: curl https://gleam.run/install.sh | sh
macOS: brew install gleam
Verify: gleam --version

QUICK START EXAMPLE

gleam new my_app
cd my_app
gleam run # Runs src/my_app.gleam
gleam test # Run tests
gleam build # Compile to _build/

SUBCOMMANDS

new (create project), init, build, check, run, format, test, docs, publish, otp, diagnose

HISTORY

Created by Louis Pilfold in 2019 to modernize Erlang development. Alpha releases began 2020; v0.30 introduced JavaScript target (2022). v1.0.0 (June 2024) marked stable APIs, better perf, and ecosystem maturity. Now powers production apps at Fly.io.

SEE ALSO

erlc(1), rebar3(1), esbuild(1), cargo(1)

Copied to clipboard