|
|
@@ -0,0 +1,74 @@ |
|
|
I recently got excited about functional programming and wanted to learn more and then my friend recommended I check out Elixir. |
|
|
I tried to install it and got stuck for so many hours that I nearly gave up. Nearly. |
|
|
Here's how I pulled it together, if I remember the steps correctly |
|
|
|
|
|
# How it didn't work |
|
|
First, I was so excited that I just jumped on youtube and followed a tutorial from 2017 that started with installing Erlang from their official homepage. |
|
|
That didn't quite work once I tried `brew install elixir` so I got rid of that erlang again and installed the whole thing through homebrew. |
|
|
This continued to give me Segmentation Faults every time I started `erl` or `elixir -v`. |
|
|
|
|
|
# How it worked in the end |
|
|
First off, this [answer](/Library/Apple/usr/bin) on stack exchange was tremendous help. |
|
|
|
|
|
In essence, I installed homebrew two times: |
|
|
- `/usr/local` for macOS Intel |
|
|
- `/opt/homebrew` for macOS ARM (i.e. the M1) |
|
|
|
|
|
Since homebrew now supports the ARM, you should be able to execute the installation command from their homepage basically anywhere BUT with an important difference: you have to do it once with Rosetta enabled for your terminal and once without. (To toggle that, find your terminal-application in the Applications on your Mac, press CMD+i and click "Open using Rosetta") |
|
|
|
|
|
Then create aliases like the following in your respective config, mine was `.zshrc`, yours might be `.bashrc`. Open up that file and copy the following in, save and make sure to run `source .zshrc` afterwards to make the changes available. |
|
|
``` |
|
|
alias ibrew='arch -x86_64 /usr/local/bin/brew' |
|
|
alias mbrew='arch -arm64e /opt/homebrew/bin/brew' |
|
|
``` |
|
|
|
|
|
Add the paths also to your `$PATH`, mine looks like this now: |
|
|
``` |
|
|
/opt/homebrew/bin |
|
|
/opt/homebrew/opt |
|
|
/usr/local/bin |
|
|
/usr/bin |
|
|
/bin |
|
|
/usr/sbin |
|
|
/sbin |
|
|
``` |
|
|
|
|
|
I then opened my terminal __with Rosetta enabled__ and used the `mbrew`-alias to finally install elixir: |
|
|
`mbrew install elixir`. This is the part that I don't actually understand as `mbrew` was supposed to be for the ARM, but then I run the terminal in Intel mode, and this works? Please explain. |
|
|
|
|
|
For the record, here's the output: |
|
|
``` |
|
|
mbrew install elixir |
|
|
==> Downloading https://ghcr.io/v2/homebrew/core/erlang/manifests/24.0.3 |
|
|
Already downloaded: /Users/nils/Library/Caches/Homebrew/downloads/027550f618a59746484f459f55e84ef651985d2fb6a069db89de6811bf81f9e2--erlang-24.0.3.bottle_manifest.json |
|
|
==> Downloading https://ghcr.io/v2/homebrew/core/erlang/blobs/sha256:8ebaae00022e7bb359df1fac2a45ecb371cb5cc96b69d18f6 |
|
|
Already downloaded: /Users/nils/Library/Caches/Homebrew/downloads/5c53a77440f083d502206706a014e2edb930a1e6c3afdc0d892e4be24b010896--erlang--24.0.3.arm64_big_sur.bottle.tar.gz |
|
|
==> Downloading https://ghcr.io/v2/homebrew/core/elixir/manifests/1.12.2 |
|
|
Already downloaded: /Users/nils/Library/Caches/Homebrew/downloads/8626a537d9ef8c8557b438f56bafa283c3118c22fd446f8b6eed37833a19a5a7--elixir-1.12.2.bottle_manifest.json |
|
|
==> Downloading https://ghcr.io/v2/homebrew/core/elixir/blobs/sha256:9931199e37b5ed93b73b10cbbea910f735d537d935f7e0609 |
|
|
Already downloaded: /Users/nils/Library/Caches/Homebrew/downloads/edbddd60e0d95dd14a7781aaa07aea59aabc993ba813d73d7b0172b53db17140--elixir--1.12.2.arm64_big_sur.bottle.tar.gz |
|
|
==> Installing dependencies for elixir: erlang |
|
|
==> Installing elixir dependency: erlang |
|
|
==> Pouring erlang--24.0.3.arm64_big_sur.bottle.tar.gz |
|
|
🍺 /opt/homebrew/Cellar/erlang/24.0.3: 7,619 files, 482.9MB |
|
|
==> Installing elixir |
|
|
==> Pouring elixir--1.12.2.arm64_big_sur.bottle.tar.gz |
|
|
🍺 /opt/homebrew/Cellar/elixir/1.12.2: 434 files, 6.4MB |
|
|
``` |
|
|
``` |
|
|
erl |
|
|
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace] |
|
|
|
|
|
Eshell V12.0.3 (abort with ^G) |
|
|
``` |
|
|
``` |
|
|
elixir -v |
|
|
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace] |
|
|
|
|
|
Elixir 1.12.2 (compiled with Erlang/OTP 24) |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
My hope in sharing this learning is is to help a fellow struggling enthusiast to get started or to receive a comment from a more experienced fellow explaining what caused me so much trouble and maybe advising an easier way forward. |
|
|
|