LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mix

Elixir build tool and task runner

TLDR

Create a new project
$ mix new [project_name]
copy
Fetch dependencies
$ mix deps.get
copy
Compile the project
$ mix compile
copy
Run tests
$ mix test
copy
Start an interactive shell with the project loaded
$ iex -S mix
copy
Format source files
$ mix format
copy
Build a production release
$ mix release
copy
List all available tasks
$ mix help
copy

SYNOPSIS

mix [task] [options]

DESCRIPTION

mix is the build tool that ships with Elixir. It manages project creation, dependency resolution, compilation, testing, code formatting, and releases. All functionality is exposed through a task-based system where each `mix task` maps to a Mix.Task module.Dependencies are declared in `mix.exs` and fetched from the Hex package manager. The active environment is controlled by the `MIX_ENV` variable, which defaults to `dev` (and `test` when running `mix test`). Custom tasks can be created by defining modules under `Mix.Tasks.*`.

PARAMETERS

new NAME

Create a new Elixir project in a directory named NAME.
deps.get
Fetch all project dependencies listed in `mix.exs`.
deps.compile
Compile fetched dependencies.
deps.update DEP
Update a specific dependency (or `--all` to update all).
compile
Compile the current project and its dependencies.
test
Run the project's test suite.
format
Format Elixir source files according to the standard formatter.
run FILE
Execute a script or expression within the project context.
clean
Remove build artifacts.
release
Assemble a self-contained release for deployment.
do task1, task2
Run multiple tasks sequentially in one command.
help [TASK]
List all available tasks, or show help for a specific task.

CAVEATS

Requires Elixir to be installed. Package installation requires Hex (`mix local.hex`). The `MIX_ENV` environment variable controls which configuration is active (`dev`, `test`, `prod`).

HISTORY

Mix was created as the standard build tool for Elixir by José Valim and ships with every Elixir installation.

SEE ALSO

elixir(1), iex(1)

Copied to clipboard
Kai