Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@huffman
Created March 2, 2012 03:50
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save huffman/1955470 to your computer and use it in GitHub Desktop.
Save huffman/1955470 to your computer and use it in GitHub Desktop.
Elixir Homebrew recipe
# Install this recipe with:
# brew install --HEAD https://raw.github.com/gist/1955470/c58bda92f07147afff64a86d0c2d8ef65adb9cd6/elixir.rb
require 'formula'
class Elixir < Formula
homepage 'http://elixir-lang.org/'
head 'https://github.com/elixir-lang/elixir.git'
depends_on 'erlang'
def install
system "make"
bin.install Dir['bin/*']
prefix.install Dir['ebin/', 'exbin/']
end
def test
system "elixir"
system "elixirc"
system "iex"
end
end
@josevalim
Copy link

Question, can we specify the erlang version we depend on? We need at least Erlang R15B. :)

@huffman
Copy link
Author

huffman commented Mar 2, 2012

I looked into it but they don't currently support it. Maybe we can print out a message during install to clarify the version dependency.

@alco
Copy link

alco commented Apr 13, 2012

Last time I updated Elixir on my machine, Homebrew also installed the newest version of Erlang (R15B01).

On another occasion, it installed the latest automake before updating Elixir. Has anyone got a clue why?

@paulmillr
Copy link

why isn't this in homebrew core?

@josevalim
Copy link

@alco AFAIK, this is how homebrew works, it installs the latest dependencies across the board. Elixir depends on Erlang which then depends on automake.

@paulmillr homebrew does not accept head-only packages. As soon as we release the next Elixir version, we will be able to push it to homebrew.

@dch
Copy link

dch commented May 28, 2012

@josevalim I suggest you provide a formula like this one with a --head or --devel option now, https://github.com/mxcl/homebrew/blob/master/Library/Formula/couchdb.rb and confirm you'll be tagging a release soon. I'd guess that will be sufficient.

@alco because --head is a recursize flag in homebrew, driving erlang to latest release. Latest homebrew releases take into account that you no longer need XCode to build from source, and that the apple-provided non-XCode compiler bundle also requires auto* to be feature-complete.

@huffman for CouchDB we check erlang version in configure.ac via
otp_release="${ERL} -noshell -eval 'io:put_chars(erlang:system_info(otp_release)).' -s erlang halt" and something similar could be done during brew recipe for elixir wrapped with a grep or similar check.

@josevalim
Copy link

@dch thanks! We have already submitted a pull request to home brew: Homebrew/legacy-homebrew#12450

@millisami
Copy link

@josevalim I tried to install via the homebrew as suggested above.
After installation, when I try to fire the iex console, it fails to start.

millisami at sachin in ~
○ brew install --HEAD https://raw.github.com/gist/1955470/c58bda92f07147afff64a86d0c2d8ef65adb9cd6/elixir.rb           ruby-1.9.3-p194
######################################################################## 100.0%
==> Installing elixir dependency: erlang
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.snowleopard.bottle.tar.gz
######################################################################## 100.0%
==> Pouring erlang-R15B01.snowleopard.bottle.tar.gz
/usr/local/Cellar/erlang/R15B01: 6991 files, 270M
==> Installing elixir
==> Cloning https://github.com/elixir-lang/elixir.git
Cloning into /Library/Caches/Homebrew/elixir--git...
remote: Counting objects: 897, done.
remote: Compressing objects: 100% (771/771), done.
remote: Total 897 (delta 293), reused 296 (delta 54)
Receiving objects: 100% (897/897), 790.69 KiB | 29 KiB/s, done.
Resolving deltas: 100% (293/293), done.
==> make
Warning: tried to install empty array to /usr/local/Cellar/elixir/HEAD
Warning: Non-executables were installed to "bin".
Installing non-executables to "bin" is bad practice.
The offending files are:
/usr/local/Cellar/elixir/HEAD/bin/elixir.bat
/usr/local/Cellar/elixir/HEAD/bin/elixirc.bat
/usr/local/Cellar/elixir/HEAD/bin/iex.bat
/usr/local/Cellar/elixir/HEAD/bin/mix.bat
==> Summary
/usr/local/Cellar/elixir/HEAD: 11 files, 44K, built in 70 seconds
brew install --HEAD   34.22s user 19.68s system 1% cpu 1:06:46.18 total
millisami at sachin in ~
○ iex                                                                                                                  ruby-1.9.3-p194
zsh: correct 'iex' to 'lex' [nyae]? n
{"init terminating in do_boot",{undef,[{elixir,start_cli,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
millisami at sachin in ~1 ↵

@josevalim
Copy link

@millisami Yes, this no longer works for Elixir master. I will update this soon on my fork: https://gist.github.com/1968046 I will let you know when.

@josevalim
Copy link

@millisami the formula at https://gist.github.com/1968046 is up to date and ready to go!

@millisami
Copy link

@josevalim Thanks, I'll try it out.

@millisami
Copy link

@josevalim, yup that works. Now heading to the doc site and do play-around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment