Build & run
rebar3 compile
Fetch deps and compile all apps
rebar3 compile -d
Compile dependencies only
rebar3 clean
Remove compiled beams
rebar3 clean --all
Clean deps and all profiles too
rebar3 shell
Shell with apps and deps loaded
Starts the apps in the shell; use --start-clean to load code
without starting them.
rebar3 shell --sname <name>
Shell as a named node
rebar3 shell --apps <a>,<b>
Start only these apps
rebar3 shell --config <file>
Use a sys.config file
rebar3 shell --eval "<expr>."
Run Erlang code on start
rebar3 shell --setcookie <cookie>
Set the distribution cookie
rebar3 do <task>,<task>
Run several tasks in a row
rebar3 path --lib
Print library paths of the build
rebar3 escriptize
Package an escript executable
rebar3 version
Show rebar3 and Erlang versions
Test
rebar3 eunit
Run all EUnit tests
rebar3 eunit --module=<mod>
Tests of one module
rebar3 eunit --test=<mod>:<fun>
Run one test function
rebar3 eunit --application=<app>
Tests of one app
rebar3 eunit --file=<path>
Tests from a source file
rebar3 eunit -v
Verbose output
rebar3 ct
Run all Common Test suites
Suites are *_SUITE.erl files in each app's test/
directory.
rebar3 ct --suite=<path>
Run one suite
Comma-separate several suites; the path has no .erl extension.
rebar3 ct --suite=<path> --group=<g>
Run one test group
rebar3 ct --suite=<path> --case=<c>
Run one test case
rebar3 ct --repeat <n>
Repeat the run n times
rebar3 ct --sys_config=<file>
Use a sys.config for tests
rebar3 ct --verbose
Print more output
rebar3 eunit --cover
Collect coverage data
rebar3 ct --cover
Collect coverage data
rebar3 cover --verbose
Coverage report in the console
rebar3 cover --min_coverage <pct>
Fail below a percentage
rebar3 do eunit,ct
Run both test types
Dependencies
rebar3 deps
List deps and lock status
rebar3 tree
Show the dependency tree
rebar3 upgrade
Upgrade all dependencies
rebar3 upgrade <dep>
Upgrade one dependency
Also upgrades the subtree of that dependency.
rebar3 unlock <dep>
Drop a dependency from the lock
rebar3 update
Refresh the Hex package index
rebar3 get-deps
Fetch deps without compiling
rebar3 lock
Fetch unbuilt deps into the lock
deps in rebar.config
{deps, [ cowboy, {jsx, "~> 3.1"}, {mylib, {git, "<url>", {tag, "1.0.0"}}}, {other, {git, "<url>", {branch, "main"}}}]}.
Profiles
rebar3 as <profile> <task>
Run a task in a profile
rebar3 as <p1>,<p2> <task>
Combine profiles
REBAR_PROFILE=<profile> rebar3 <task>
Set the base profile by env
rebar3 as test compile
Build with test profile deps
profiles in rebar.config
{profiles, [ {test, [{deps, [meck]}]}, {prod, [{erl_opts, [no_debug_info]}]}]}.
Releases
rebar3 release
Build a dev release
rebar3 as prod release
Release with ERTS, no symlinks
rebar3 as prod tar
Release as a .tar.gz
rebar3 relup
Build a release upgrade
_build/<profile>/rel/<name>/bin/<name>
console
Start a release in a shell
bin/<name> foreground
Run in foreground (systemd, Docker)
bin/<name> daemon
Run as a background node
bin/<name> remote_console
Attach to a running node
bin/<name> ping / stop / restart
Control a running node
bin/<name> eval "<expr>"
Evaluate code on a node
relx in rebar.config
{relx, [ {release, {<name>, "0.1.0"}, [<name>, sasl]}, {dev_mode, true}, {include_erts, false}, {extended_start_script, true}]}.
Config & plugins
Compile options
{erl_opts, [debug_info, warnings_as_errors]}.{minimum_otp_vsn, "26"}.
Aliases and hooks
{alias, [{check, [xref, dialyzer, eunit, ct]}]}.{provider_hooks, [{pre, [{compile, clean}]}]}.
rebar3 alias
List aliases from rebar.config
Plugins
{plugins, [rebar3_auto]}.{project_plugins, [erlfmt]}.
rebar3 plugins upgrade <plugin>
Upgrade a plugin
rebar3 completion
Generate shell completion