MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Fedora Exlixir Install

without comments

Having played around with Erlang some twelve years ago, I felt it was time to experiment with the Elixir programming language. The install on Fedora was straightforward with Dandified YUM. Naturally, you need to be the root user or a user found in the sudoer‘s list:

sudo dnf install -y elixir

The installation said to add it to the $PATH variable but on Fedora 30, a symbolic link of elixir is installed in the /usr/bin directory that points to /usr/share/elixir/1.9.0/bin/elixir shell script. Next, a version check, like this:

elixir --version

it returned

Erlang/OTP 21 [erts-10.3.5.11] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
 
Elixir 1.9.0 (compiled with Erlang/OTP 21)

Next, I created a little elixir test program, naturally after I glanced through the documentation for a Hello World program, like this hello.exs file:

IO.puts "Hello, Elixir World!"

Then, I ran it as stand alone file with only read and write, read, and read privileges:

elixir hello.exs

It returns:

Hello, Elixir World!

Next, I tried to read the file from the file system in the iex interactive shell. I thought the example on the website was odd because it gave the impression that you were to call iex recursively but I discovered that’s not the case. You can only run it from the OS shell, and the file must have read, write, execute privileges for whomever calls it. Then, this syntax works from the Linux CLI interfaace:

iex -S hello.exs

Then, you exit the shell by issuing a ^Z (CTRL+Z). If you try ^C, you’ll need to follow that with ^D, which I found in some notes. The ^Z is the normal kill signal for the current process, which appears the proper way to exit the iex interactive shell. Overall, the interactive shell is virtually useless except to validate small syntax examples.

Written by maclochlainn

May 20th, 2020 at 11:47 pm