DEV Community

Cover image for How to Set Up Elixir
Rusydy
Rusydy

Posted on

2

How to Set Up Elixir

To set up Elixir, you will need to first install Erlang. Elixir is built on top of the Erlang virtual machine, so you will need to have Erlang installed to run Elixir.

To install Erlang, you can use Homebrew by running the following command in your terminal:



brew install erlang


Enter fullscreen mode Exit fullscreen mode

Once Erlang is installed, you can install Elixir using Homebrew as well by running the following command:



brew install elixir


Enter fullscreen mode Exit fullscreen mode

Once both Erlang and Elixir are installed, you can create a new Elixir project using the mix command. The mix command is Elixir's build tool, and it can be used to create new projects, manage dependencies, and run tests.

To create a new Elixir project, you can use the mix new command, followed by the name of your project. For example, if you want to create a new project called "hello_world", you can run the following command:



mix new hello_world


Enter fullscreen mode Exit fullscreen mode

This will create a new directory called "hello_world" in your current location, and it will generate the basic file structure and configuration files for your new Elixir project.

Once your new project is set up, you can navigate to the project directory and start the Elixir interactive shell (or "REPL") by running the iex command:



cd hello_world
iex


Enter fullscreen mode Exit fullscreen mode

This will start the iex REPL, where you can run Elixir code and interact with your project. You can start experimenting with Elixir and learning the language by typing Elixir code directly into the iex REPL.

For more information about installing and using Elixir, you can check out the official Elixir website at https://elixir-lang.org/.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay