Skip to content

Instantly share code, notes, and snippets.

@Kotauror
Last active May 8, 2019 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kotauror/eb5d29575d63322356bce30bc781562c to your computer and use it in GitHub Desktop.
Save Kotauror/eb5d29575d63322356bce30bc781562c to your computer and use it in GitHub Desktop.
Fix Erlang builds

This note explains how I've solved a problem with building Erlang 21.0.

I used to use evm for managing versions of Erlang. After I've installed Erlang 21.0, I've tried to run mix and this gave me the following error: ** (MatchError) no match of right hand side value: {:error, {:crypto, {'no such file or directory', 'crypto.app'}}}.

I've then decided to use kerl instead of evm because of bigger online support. However, kerl gave me errors when I was trying to build Erlang 21.0 (kerl build 21.0 21.0).

The core of the problem with building Erlang 21.0 was hardcoding the version 20.0 of Erlang into my $PATH. I used to have this:

export PATH=/Users/justynazygmunt/.kiex/elixirs/elixir-1.5.3/bin:$PATH
exprot PATH=/Users/justynazygmunt/kerl/.20.0/bin:$PATH

And now I have this:

export PATH=/usr/local/bin/kerl:$PATH
export PATH=/Users/justynazygmunt/.kiex/bin:$PATH

Once I cleaned up the $PATH, I removed all installations and builds available via kerl (kerl list builds, kerl list installations). Deleting builds and installations leaves some old files behind - in order to finish the clean up, run kerl cleanup and then check the content of ~/kerl.

If you do kerl cleanup after kerl build... but BEFORE kerl install... then you won’t be able to install with an error like: /usr/local/bin/kerl: line 815: cd: /Users/yourUserName/.kerl/builds/21.0/otp_src_21.0: No such file or directory

Once there are no old files, run the following:

  • build a version of Kerl eg. kerl build 21.0 21.0
  • install the versin eg. kerl install 21.0 ~/kerl/21.0
  • activate the version: eg. . /Users/yourUserName/kerl/21.0/activate -> see that it was added at the beginning of your path: echo $PATH
  • see that it is active: kerl active
  • in order to deactivate it, run kerl_deactivate -> see that it was deleted from the beginning of your path: echo $PATH

Erlang is activated in the particular shell. Open a new shell and see that there is no active Erlang kerl active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment