Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

Configuration Files

rebar.config

Location: Project root directory

Format: Erlang terms

Common Options:

{erl_opts, [debug_info, warnings_as_errors]}.
{deps, [
    {jsx, "3.1.0"},
    {cowboy, {git, "https://github.com/ninenines/cowboy.git", {tag, "2.9.0"}}}
]}.
{plugins, [rebar3_hex]}.
{profiles, [
    {test, [
        {deps, [meck, proper]},
        {erl_opts, [{d, 'TEST'}]}
    ]}
]}.

rebar.lock

Location: Project root directory

Format: Versioned Erlang terms

Purpose: Lock dependency versions for reproducible builds

Example:

{"1.2.0",
[{<<"jsx">>, {pkg,<<"jsx">>,<<"3.1.0">>}, 0}]}.
[
{pkg_hash,[
 {<<"jsx">>, <<"...">>}]}
].

~/.config/rebar3/rebar.config

Location: User's global configuration directory

Purpose: Global settings and plugins

Common Uses:

  • Global plugins (hex, dialyzer, etc.)
  • Hex repository credentials
  • Global compiler options

Environment Variables

VariableEffectDefault
REBAR_PROFILEOverride active profilenone
REBAR_BASE_DIRBuild output directory_build
REBAR_CACHE_DIRGlobal cache location~/.cache/rebar3
REBAR_OFFLINEDisable network accessnot set
REBAR_SKIP_PROJECT_PLUGINSSkip project plugin installationnot set
HEX_CDNHex package CDN URLdefault Hex CDN
QUIETMinimal outputnot set
DEBUGVerbose debugging outputnot set
DIAGNOSTICVery verbose outputnot set

Command-Line Options

Global options (available for all commands):

  • -h, --help: Show help
  • -v, --version: Show version information
  • --offline: Run in offline mode (no network access)

Configuration Precedence

Configuration is merged in the following order (later overrides earlier):

  1. Built-in defaults
  2. ~/.config/rebar3/rebar.config (global config)
  3. Project rebar.config
  4. Profile-specific configuration
  5. Environment variables
  6. Command-line options