elixir

Functional language runtime on Erlang VM

TLDR

Run Elixir script
$ elixir [script.exs]
Evaluate expression
$ elixir -e "[IO.puts \"Hello\"]"
Start with shell
$ elixir -S iex
Run with Mix project
$ elixir -S mix run
Start named node
$ elixir --name [node@host] -S iex
Set environment
$ MIX_ENV=prod elixir -S mix phx.server

SYNOPSIS

elixir [options] [script] [args]

DESCRIPTION

elixir runs Elixir code and scripts. It's the primary command for executing Elixir programs, supporting both script files (.exs) and compiled modules.The command starts the Erlang VM with Elixir loaded. Options control distributed computing settings, code loading, and execution mode. Combined with `-S mix`, it runs Mix tasks.Elixir's interactive shell (IEx) can be started using `elixir -S iex` for development and debugging.

PARAMETERS

SCRIPT

Elixir script file to run.
-e CODE
Evaluate code string.
-r FILE
Require file before execution.
-S SCRIPT
Run Erlang/Elixir script.
--name NAME
Set distributed node name.
--sname NAME
Set short node name.
--cookie COOKIE
Set Erlang distribution cookie.
--no-halt
Do not exit after the script finishes; keep the VM running.
--erl SWITCHES
Pass switches through to the underlying erl command.
--rpc-eval NODE CODE
Evaluate code on a remote running node.
-v, --version
Print the Elixir and Erlang/OTP versions.
--help
Display help information.

INSTALL

sudo apt install elixir
sudo dnf install elixir
sudo pacman -S elixir
sudo apk add elixir
sudo zypper install elixir
brew install elixir

CAVEATS

Requires Erlang/OTP installed. Startup time includes BEAM VM boot. Scripts have .exs extension by convention. Distributed features need network configuration.

HISTORY

Elixir was created by José Valim and released in 2011, running on the Erlang BEAM VM. It brought modern syntax and tooling to the Erlang ecosystem while maintaining compatibility.

SEE ALSO

iex(1), mix(1), erl(1)

RESOURCES

Source code · Homepage · Documentation