How to set up a elixir programming workspace

A good Elixir workspace is deliberately boring. You want one version manager, one editor that formats on save, one terminal you know how to split, and a folder for experiments you are allowed to delete. Build that in an afternoon, then stop rearranging it and start writing functions.

Install a version manager first

Elixir runs on the Erlang virtual machine, so the two versions are a pair. Install a version manager such as asdf or mise, add both Erlang and Elixir through it, and commit a .tool-versions file to every project. That file is the cheapest documentation you will ever write: anyone who clones the repo installs the same pair with one command.

Verify the install in a fresh terminal with elixir --version and mix --version. If those numbers disagree with what you installed, your shell is picking up an older binary from somewhere else in PATH, and every confusing error after that point is downstream of it.

Editor settings that pay for themselves

Pick an editor with a working language server — ElixirLS or Next LS — and turn on format on save. Elixir ships its own formatter, so there is no style argument to have: mix format decides, and the default line length is generous enough that most code fits. Add the formatter check to your habit early with mix format --check-formatted.

  • Format on save, every file, no exceptions.
  • Show whitespace so you notice trailing spaces and mixed indentation.
  • Bind a key to open the documentation for the word under the cursor.
  • Keep the test file and the module it tests in adjacent tabs, not adjacent monitors.

Arrange the terminal around feedback

Two panes are usually enough. Left pane: an iex -S mix session for poking at functions. Right pane: mix test on a loop, or the server log if you are running Phoenix. A third pane for git status is fine; a sixth pane of dashboards is a way of avoiding the work.

Add one habit that saves hours later: run mix test --failed first after a red run. It re-runs only what broke, which keeps the feedback loop short while you are fixing a single function.

Make a scratch project and break it on purpose

Create a throwaway with mix new scratch, run the generated tests, add a dependency, then delete a line to see what an error looks like. Knowing the shape of a compile warning before you meet one in real code removes most of the intimidation. Keep this project outside your main folder so it never becomes precious.

One thing to leave out: containers, continuous integration, and deployment scripts are worth learning, but they are not part of a beginner workspace. They add failure modes that look like language problems. Get comfortable with mix first; it already does compiling, testing, formatting, documentation, and releases, which covers more than most people expect.

The test of a good setup

Open a terminal, run one command, and see a passing test. If that takes more than a minute of thought, simplify something. A workspace you trust is the difference between experimenting freely and hoarding code you are afraid to change.