elixir
Compile and run Elixir code
TLDR
Run an Elixir file
Evaluate Elixir code by passing it as an argument
SYNOPSIS
elixir [options] [file] [args]
PARAMETERS
-e EXPR
evaluate the Elixir expression EXPR
-S FILE
find and execute the script FILE
-r FILE
require FILE to be loaded before the script
-I DIR
inherit the code path from the parent
--preload
preload all Erlang modules
-pa PATH
prepend PATH to the code path
-pz PATH
append PATH to the code path
--app APP
start application APP
--boot BOOT
use BOOT as the boot script
--boot-var VAR
set boot variable VAR to value
-v
print elixir version and exit
--version
print elixir version and exit
--help
print this help
--erl-flags OPTS
pass ERTS flags as OPTS
DESCRIPTION
The elixir command executes Elixir scripts and expressions on the Erlang BEAM virtual machine, enabling concurrent, fault-tolerant applications. Elixir, a dynamic functional language built atop Erlang, excels in scalability with lightweight processes, hot code swapping, and distribution.
elixir compiles and runs .ex (source) or .exs (script) files non-interactively, ideal for automation, deployments, or batch processing. Arguments pass to scripts via System.argv/0. It supports code loading, path manipulation, and app bootstrapping, inheriting Erlang's robustness for telecom-grade reliability.
Key strengths include pattern matching, immutability, and macros for metaprogramming. Used in projects like Phoenix framework for web apps.
CAVEATS
Non-interactive; use iex for REPL. Requires Elixir installation. Errors halt execution unless handled.
EXAMPLES
elixir -e "IO.puts 'Hello World'"
elixir myscript.exs arg1 arg2
elixir -S mix run
FILE EXTENSIONS
.ex: compiled modules.
.exs: scripts, no beam files.
HISTORY
Created by José Valim in 2011 as dynamic alternative to Erlang; first stable release 1.0 in 2014. elixir command evolved with OTP integration, improving concurrency and tooling.


