Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 833 of the free egghead.io lessons, plus get Elm content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Just one more step!

Check your inbox for an email from us and click link to unlock your lesson.



Installing and setting up Elm

1:54 Elm lesson by

Before writing any Elm we need to first install the runtime locally. In this lesson we install the Elm runtime locally and set up a simple application to verify everything is working properly.


egghead.io comment guidelines

Avatar
egghead.io

Before writing any Elm we need to first install the runtime locally. In this lesson we install the Elm runtime locally and set up a simple application to verify everything is working properly.

To get Elm running on your machine, head over to Elm-lang.org. Click on install. There's an installer for Mac, Windows, or MPM. This is the one I prefer. In your terminal, we can run MPM install-g for our global install making it accessible from anywhere in the terminal. I already have this, so I'll skip this step, and just run Elm.

We see that there are commands with a description of what they do. Let's clear that out and start by creating a main.elm file. Then you can open your favorite text editor.

We can start by importing HTML. Let's just pull in what we need for now. We will create a main. This is the entry point for our app and call the text function to write out "Hello, world." This isn't ready to run.

We first need to install some dependencies. Let's type Elm again. We see a packages command. This works similar to MPM, so we can run Elm package install. This installs the core. It asks if we approve this plan. We'll say yes.

Now we need to install the HTML package. Again, it asks if we want to install this. It also comes with some dependencies. It wants us to approve those before they're installed.

Running Elm again, we see Reactor as a dev server we can use. Let's run that command.

Then we can head over to the browser and hit the port listed in the console. We see a listing of files in our project. Click on main.elm. We see "Hello, world." This verifies we have everything installed correctly, and we are ready to start development.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?