6
6

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 5 years have passed since last update.

Elixirを使うためにanyenv経由でOSXにexenvをインストールした

Posted at

Elixir入門するために環境構築しました。

brew install elixirをしたくなかったので、env経由で入れようと思って調べていると、見つかった Mac OSXにanyenv/exenvでElixirをインストールする という記事がめちゃくちゃ参考になりました。

が、エラーが途中で出て、 Mac で erlenv を使う際 Erlang/OTP が OpenSSL 付きでビルドできない問題 という記事を元に解決しました。

以下、打ったコマンドです。brew経由でOpenSSLを入れていない方はbrew install opensslをしておきましょう。

$ anyenv install erlenv
$ exec $SHELL -l
$ brew install unixodbc wxmac fop
$ wget http://www.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/.anyenv/envs/erlenv/releases/19.1 --enable-dynamic-ssl-lib --with-ssl=/usr/local/opt/openssl
$ make -j 4
$ make install
$ erlenv global 19.1
$ erlenv rehash
$ exec $SHELL -l
$ cd ..
$ rm -rf otp_src_19.1 otp_src_19.1.tar.gz

ここまでやって、erlcrypto:start().がうまくいけば、多分Elixirもうまく入ります。

$ erl
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.1  (abort with ^G)
1> crypto:start().
ok
2>

自分は最初、以下のようなエラーが出て、次のexenv install 1.3.4がうまくいきませんでした。

$ erl
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.1  (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
2>

先ほど打ったように、./configureにオプションをつければ問題ありません。

では、最後にexenvを使ってElixirを入れていきます。

$ anyenv install exenv
$ exenv install 1.3.4
$ exenv global 1.3.4
$ exec $SHELL -l

elixir -vした時にきちんとバージョンが表示されれば、これにて無事Elixirが使えるようになりました。

$ elixir -v
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.3.4

Erlangのインストールが少し長かったかと思います。お疲れ様でした。

6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?