LoginSignup
9
3

More than 5 years have passed since last update.

Macにelixirをインストールする

Last updated at Posted at 2016-10-06

環境やバージョン

Mac:10.11.6
erlang:19.1
elixir:1.3.3

インストールのパターン

1.elixirをhomebrewでインストール
2.erlangをhomebrewでelixirをexenvでインストール
3.erlangをerlenvでelixirをexenvでインストール
※追記
試してませんが、asdfによるインストールやanyenvでのインストールも便利そうです。
-asdf
http://qiita.com/ymtszw/items/28cc7a000236510b71c2
-anyenv
http://qiita.com/nownabe/items/67a27ddd23652676ffee

1.elixirをhomebrewでインストール

単一バージョンならbrewでいい

brew update
brew install elixir

必要なerlangも一緒に入る

2.erlangをhomebrewでelixirをexenvでインストール

erlangをbrewでインストール

brew update
brew install erlang

一緒に入るopensslがbrewではなく、Mac標準のを見てしまうのでパスを通す。

// 上の方に
export PATH=/usr/local/opt/openssl/bin:$PATH
source ~/.bash_profile

exenvをbrewでインストール

brew install elixir-build
brew install exenv

.bash_profileに追加

echo 'export PATH="$HOME/.exenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(exenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

elixirのインストールできるバージョンの確認とインストール

exenv install -l
exenv install 1.3.3
exenv global 1.3.3
elixir -v

3.erlangをerlenvでelixirをexenvでインストール

opensslをbrewでインストール

brew update
brew install openssl

opensslは上記でインストールしてもMac標準のを見てしまうのでパスを通す。

// 上の方に
export PATH=/usr/local/opt/openssl/bin:$PATH
source ~/.bash_profile

erlenvをgitで取得

$ cd
$ git clone https://github.com/talentdeficit/erlenv.git .erlenv

.bash_profileに追加

echo 'export PATH="$HOME/.erlenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(erlenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

erlangインストール

erlenvはinstallコマンドがないようで、自分でビルドして配置しないといけない(erlangはbrewでもいいかな・・)

// ダウンロードと解凍
curl -O http://erlang.org/download/otp_src_19.1.tar.gz
tar zxf otp_src_19.1.tar.gz
cd otp_src_19.1

// ビルド
./configure --prefix=$HOME/.erlenv/releases/19.1 --enable-smp-support --enable-threads --enable-darwin-64bit --enable-kernel-poll --enable-hipe --without-javac --disable-native-libs --disable-sctp --with-ssl=/usr/local/opt/openssl
touch lib/wx/SKIP lib/odbc/SKIP
make
sudo make install
erlenv global 19.1
erlenv rehash

// 確認
erl

exenvをbrewでインストール

brew install elixir-build
brew install exenv

.bash_profileに追加

echo 'export PATH="$HOME/.exenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(exenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

elixirのインストールできるバージョンの確認とインストール

exenv install -l
exenv install 1.3.3
exenv global 1.3.3
elixir -v
9
3
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
9
3