apt update; apt upgrade to have your system up to date.
Install Erlang with apt install erlang, you should be able to run erl.
(check if an Elixir package was created so you can avoid the trouble of the remaining lines )
Install wget with apt install wget (otherwise you will get bad address on any wget request).
Create a directory, and cd to it, for example: mkdir elixir; cd elixir.
Download the precompiled package from the link named Precompiled.zip file for the latest release in the page http://elixir-lang.org/install.html#precompiled-package.At time of this writing the command wget https://github.com/elixir-lang/elixir/releases/download/v1.4.2/Precompiled.zip should do this.
Execute sh termux-fix-shebang elixir iex elixircin the bin directory (sh is required as the path of the shebang of the script is not compatible with termux).
Execute which env and edit the first line of mix to set the path of command envto the one found by the command which.
Add export PATH=$PATH:$HOME/elixir/bin to your .bashrc or execute the command on your terminal.
You can then mix and iex. An Android phone is not exactly a convenient development platform, but it was useful to me to learn Elixir when waiting for whatever.
Thanks for that!
When I apt install wget, Im asked to validate with [Y/n].
If I press y or Y:
No command y found, did you mean Command [ from package coreutils, Command k from package kona etc.
And pressing Enter directly does nothing
Any idea please?
Please try apt install --yes wget, for the older interface to apt, that meant to not ask but assume the operator knows what he is doing and install/remove everything. Can’t check though if it is still valid on the new interface which is used by termux.
thank your guides. i can use elixir on my android phone and can install phoenix. but when i execute “mix ecto.create”. it has a problem,it said i do not install rebar3.but i have install rebar3 with mix. do you have this problem?
this is the error
sh: 1: /data/data/com.termux/files/home/.mix/rebar3: not found
** (Mix) Could not compile dependency :ranch, “/data/data/com.termux/files/home/.mix/rebar3 bare compile --paths “/data/data/com.termux/files/home/hello/_build/dev/lib/*/ebin”” command failed. You can recompile this dependency with “mix deps.compile ranch”, update it with “mix deps.update ranch” or clean it with “mix deps.clean ranch”
~/.mix/rebar3 help
zsh: /data/data/com.termux/files/home/.mix/rebar3: bad interpreter: /usr/bin/env: no such file or directory
realpath ~
/data/data/com.termux/files/home
$PATH
zsh: no such file or directory: /data/data/com.termux/files/usr:/data/data/com.termux/files/home/.mix:/data/data/com.termux/files/home/elixir/bin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
We do know now, that the script goes through escript and erlang now, but it seems as if escript requires the shebang to be exactly#!/usr/bin/env escript.
You’ll need to manually compile rebar dependencies by calling escript ~/.mix/rebar3 and hoping that simply copying arguments from mix’s error message will be sufficient.
Did you run PHX successfully on termux?
i can run rebar3 with “escript ~/.mix/rebar3”. but when i run “mix ecto.create”, it has the same problem
“”"
sh: 1: /data/data/com.termux/files/home/.mix/rebar3: not found
** (Mix) Could not compile dependency :ranch, “/data/data/com.termux/files/home/.mix/rebar3 bare compile --paths “/data/data/com.termux/files/home/hello/_build/dev/lib/*/ebin”” command failed. You can recompile this dependency with “mix deps.compile ranch”, update it with “mix deps.update ranch” or clean it with “mix deps.clean ranch”