Install Elixir on Windows, Mac, or Linux. Get IEx running and write your first line of code.

15 min read

Getting Your Kitchen Ready

Before we cook, we need a kitchen. Before we code, we need Elixir installed.

The good news: installing Elixir is easier than ever. The bad news: every computer is slightly different, so we need to handle a few cases.

Don't worry—if you get stuck, there's a friendly community ready to help (we'll cover that in the next chapter).

What We're Installing

When you "install Elixir," you're actually getting three tools:

  1. Elixir - The programming language itself
  2. IEx - Interactive Elixir (your playground)
  3. Mix - A build tool for creating projects

Think of these like:

  • Elixir = The cooking ingredients
  • IEx = A test kitchen where you experiment
  • Mix = A recipe organizer and kitchen manager

Installing on macOS

If you have a Mac, the easiest way is using Homebrew (a package manager for Mac).

Step 1: Open Terminal ( press Cmd + Space, type "Terminal", press Enter)

Step 2: Install Homebrew if you don't have it:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 3: Install Elixir:

brew install elixir

Wait a few minutes. Homebrew will download and install everything automatically.

Step 4: Verify it worked:

elixir --version

You should see something like:

Erlang/OTP 28 [erts-16.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.19.5 (compiled with Erlang/OTP 28)

(The exact numbers don't matter—just that you see "Elixir" and a version.)

Installing on Windows

Windows has a couple of options. We'll use the easiest one.

Option 1: Using the Installer (Easiest)

  1. Go to https://elixir-lang.org/install.html
  2. Click "Windows" and download the installer
  3. Run the installer (just keep clicking "Next")
  4. Restart your computer
  5. Open Command Prompt or PowerShell
  6. Type: elixir --version

Option 2: Using Chocolatey (If You're Comfortable with Command Line)

If you have Chocolatey installed:

choco install elixir

Installing on Linux

Linux users usually know their distribution. Here are the common ones:

Ubuntu/Debian (using mise):

The recommended way to install Elixir on Ubuntu and Debian is using mise, a tool version manager. Mise lets you install multiple versions of Elixir and Erlang side by side, which is useful when different projects need different versions.

First, install mise:

curl https://mise.run | sh

Then add mise to your shell. For Bash (the default on most Ubuntu/Debian systems):

echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
source ~/.bashrc

For Zsh:

echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
source ~/.zshrc

Now install Erlang and Elixir. Erlang must be installed first because Elixir runs on top of the Erlang virtual machine:

# Install Erlang first (Elixir needs it)
mise use -g erlang

# Then install Elixir
mise use -g elixir@latest

# Verify both are installed
elixir --version

Why use mise instead of apt? The version of Elixir in Ubuntu's package repositories is often outdated. Mise gives you the latest stable version and lets you switch between versions per project without conflicts.

Fedora:

sudo dnf install elixir

Arch Linux:

sudo pacman -S elixir

Your First Time in IEx

IEx (Interactive Elixir) is where you'll spend a lot of time. It's a playground where you can type code and see results immediately.

To start IEx:

  • macOS/Linux: Open Terminal, type iex, press Enter
  • Windows: Open Command Prompt, type iex, press Enter

You should see:

Erlang/OTP 28 [erts-16.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.19.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

That iex(1)> is your prompt. The number in parentheses increases each time you enter something.

Try typing this:

"Hello, World!"

Press Enter. You should see:

"Hello, World!"

Congratulations! You just ran your first Elixir code.

Playing Around

IEx is safe to play in. You can't break anything. Try these:

2 + 2
10 * 5
String.upcase("i am whispering")
length([1, 2, 3, 4, 5])

Each line, press Enter. See what happens. Make mistakes. Try things.

Getting Out of IEx

When you're done playing, press Ctrl+C twice, or type:

System.halt()

Troubleshooting

"Command not found" or "elixir is not recognized"

Your system doesn't know where Elixir is. Try:

  • Restarting your terminal/command prompt
  • Restarting your computer
  • Reinstalling and watching for any error messages

Installation seems to hang

Elixir downloads can take time, especially on slower connections. Give it 10-15 minutes.

Still stuck?

Check the next chapter for where to get help. Or visit:

What We Have Now

You now have:

  • Elixir installed on your computer
  • IEx, your interactive playground
  • Mix, for when we start building projects
  • The ability to run any code from this book

In the next chapter, we'll write your first real program—a tip calculator that handles all the weird edge cases real life throws at it.


What we just learned:

  • How to install Elixir on macOS, Windows, and Linux
  • IEx is an interactive playground for experimenting
  • You can do math and manipulate text right in IEx
  • Mistakes in IEx are safe—you can't break anything

Up next: Writing your first program—a tip calculator that actually makes splitting bills fun.