> ## Documentation Index
> Fetch the complete documentation index at: https://www.jetify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Elixir

> Elixir can be installed by simply running `devbox add elixir`. This will automatically include the Elixir Plugin to isolate Mix/Hex artifacts and enable shell history in `iex`.

[**Example Repo**](https://github.com/jetify-com/devbox/tree/main/examples/development/elixir/elixir_hello)

## Adding Elixir to your project[​](#adding-elixir-to-your-project "Direct link to Adding Elixir to your project")

`devbox add elixir`, or add the following to your `devbox.json`

```json theme={null}
    "packages": [
        "elixir@latest"
    ]
```

This will install the latest version of Elixir. You can find other installable versions of Elixir by
running `devbox search elixir`. You can also search for Elixir on
[Nixhub](https://www.nixhub.io/packages/elixir)

## Elixir Plugin Support[​](#elixir-plugin-support "Direct link to Elixir Plugin Support")

Devbox will automatically use the following configuration when you install Elixir with `devbox add`.

### Environment Variables[​](#environment-variables "Direct link to Environment Variables")

`$MIX_HOME` and `$HEX_HOME` configure Mix/Hex to install artifacts locally, while `$ERL_AFLAGS`
enables shell history in `iex`:

```bash theme={null}
MIX_HOME={PROJECT_DIR}/.devbox/virtenv/elixir/mix
HEX_HOME={PROJECT_DIR}/.devbox/virtenv/elixir/hex
ERL_AFLAGS="-kernel shell_history enabled"
```

### Disabling the Elixir Plugin[​](#disabling-the-elixir-plugin "Direct link to Disabling the Elixir Plugin")

You can disable the Elixir plugin by running `devbox add elixir --disable-plugin`, or by setting the
`disable_plugin` field in your `devbox.json`:

```json theme={null}
{
  "packages": {
    "elixir": {
      "version": "latest",
      "disable_plugin": true
    }
  }
}
```

Note that disabling the plugin will cause Mix and Hex to cache artifacts globally in the user's home
directory (at `~/.mix/` and `~/.hex/`). This might actually be preferable if you're developing
several Elixir projects and want to benefit from caching, but does defeat the isolation guarantees
of Devbox.

If the plugin is disabled, it's recommended to manually set `$ERL_AFLAGS` to preserve `iex` shell
history:

```json theme={null}
    "env": {
      "ERL_AFLAGS": "-kernel shell_history enabled"
    }
```

[Edit this page](https://github.com/jetify-com/docs/tree/main/docs/devbox/devbox-examples/languages/elixir/index.mdx)
