3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Windows10にElixirインストール

Last updated at Posted at 2021-07-08

久しぶりにElixirをやってみようと思い、
Windows10にインストールしたのでその時の内容をメモします。

Elixirインストール

Chocolateyを使用してインストールします。
管理者でコマンドプロンプトを起動して以下を実行します。
実行すると何度か応答が求められるのでメッセージに従って応答します。(基本Yで大丈夫です。)

> choco install elixir

以下を実行することでバージョンを確認できます。

> iex -v
IEx 1.11.2 (compiled with Erlang/OTP 21)

ElixirをインストールするとErlangもインストールされます。

> erl +V
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 12.0

Elixirインタラクティブモード起動停止

ちょっとしたお試しはインタラクティブモードが便利です。以下で起動停止できます。
起動:iex
停止::init.stop または Ctrl+Cを押してYを押す

> iex
Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :init.stop
:ok
iex(2)>
>
> iex
Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> バッチ ジョブを終了しますか (Y/N)? y
>

ちなみに、PowerShellだとiexというコマンドがもともと存在するため起動しません。
代わりに以下のコマンドを使用します。別ウインドウで起動できます。

> iex.bat --werl

スクリプトとして実行してみる。

以下のファイルを作成します。

hello.exs
IO.puts "Hello world elixir script"

実行してみます。

> elixir hello.exs
Hello world elixir script

参考

https://elixir-lang.org/
https://elixir-lang.jp/
https://elixirschool.com/ja/

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?