HowTo (Mac) - Install

Introduction

The Nerves build environment relies on a number of other components. For best results, these should be installed in layers, e.g:

  • Mac OS X - operating system
  • Xcode - development tools
  • Homebrew - package management
  • Erlang - programming language, VM
  • Elixir - programming language
  • fwup - firmware uploader
  • miscellany - coreutils, squashfs
  • Nerves - build environment
  • your Nerves application(s)

For best results, be sure that you have at least the following versions installed:

  • Elixir 1.3.2
  • Erlang 19.0.2
  • Xcode 7.2.1

Note: Much of this material is adapted from the Nerves Project's Installation page.

Xcode

Xcode provides a GUI-based IDE which has no particular relevance to Nerves. However, it also provides assorted command-line utilities and libraries which you will need. If you are running a current version of OSX, you should probably install Xcode from the Mac App Store.

If not, things get a bit trickier. I haven't used the xcode-install gem, but it looks quite promising. Alternatively, after becoming a member in the Apple Developer Program (the free level is fine), you can get Xcode from the Downloads / More page. For example, I'm using Xcode 7.2.1 on Yosemite (OSX 10.10.5).

Homebrew

What Does Homebrew Do? Homebrew installs the stuff you need that Apple didn’t.

-- Homebrew

Homebrew (aka brew) is a package management tool for Mac OS X. We'll be using it to install most of the basic infrastructure that Nerves requires (e.g., Erlang, Elixir). First, we need to make sure that we have the latest version of Homebrew and its database of package version information:

$ brew update
Updated Homebrew from bd4e24a to b512834.
...

Erlang

Install the latest versions of Erlang and Elixir, create symbolic links to the executables, etc:

$ brew unlink  erlang elixir
$ brew install erlang elixir
$ brew link    erlang elixir
...

Confirm that the current versions are found and executed.

$ elixir --version
Erlang/OTP 19 [erts-8.0.1] ...
Elixir 1.3.2

Miscellany

The fwup utility is a configurable, image-based, firmware update utility for embedded Linux-based systems. When finalizing firmware and creating a root filesystem for your target, Nerves utilizes scripts and utilities which have dependencies on coreutils and squashfs.

$ brew unlink  fwup coreutils squashfs
$ brew install fwup coreutils squashfs
$ brew link    fwup coreutils squashfs
...

Bootstrap

Add the nerves_bootstrap.ez archive to your Mix environment. This allows Nerves to bootstrap the environment, ensuring that your code uses the right cross-compiler for the target.

nb_ez=https://github.com/nerves-project/archives/raw/master/nerves_bootstrap.ez

$ mix archive.install $nb_ez
...
* creating /Users/rdm/.mix/archives/nerves_bootstrap

We have now installed everything we need to build a Nerves system image. So, let's move on to the Build step.


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r8 - 16 Jul 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email