LoginSignup
1

More than 5 years have passed since last update.

Elixirを使ってみよう

Posted at

TL;DR

インストール〜REPL立ち上げまで。

インストール

大まかな流れ

  • Erlangの依存パッケージ入れる(Javaなど)
  • Erlang入れる(OTP 18以降が良い)
  • Elixir入れる

Linux

参考:http://qiita.com/Nappa723/items/1e5b5f961754dc79dbe6
   http://qiita.com/voluntas/items/a39cf3ec1a385e612f2a

Java(Cent OS)

既にインストール済みならば飛ばしてOK

sudo yum install java-1.8.0-openjdk-devel

Others(Cent OS)

sudo yum install gcc gcc-c++ wxGTK wxGTK-devel \
fop ncurses ncurses-devel \
openssl openssl-devel \
mariadb-server mariadb unixODBC unixODBC-devel

Erlang

バージョン管理ツールのkerl( https://github.com/kerl/kerl )を利用する。

curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl

パス通っているところに置く。

example
sudo mv kerl /bin/

利用可能なパッケージを探す

kerl update releases
kerl list releases

ビルド

kerl build 19.1 19.1

2つ目の19.1はビルドに付ける名称。

Mac

Java

既にインストール済みならば飛ばしてOK

参考:http://qiita.com/yanap/items/186d5bd1118f68f725d8

brew cask install java
~/.bashrc
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Elixir

brew install elixir

Windows

chocolatelyインストール

macでいうhomebrew。

コマンドプロンプトを管理者で開く

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Elixir

コマンドプロンプトを管理者で再起動して

cinst elixir

REPL

起動

iex

print

iex(1)> IO.puts "Hello"
output
Hello
:ok

bind variable

iex(2)> a = 1
iex(3)> i a
output
Term
  1
Data type
  Integer
Reference modules
  Integer

その他の機能は公式ドキュメントを参照

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
1