Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Installing and setting up Elm

    Ronn RossRonn Ross
    elmElm

    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.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    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.