asdf-vm / asdf-vm/asdf-elixir

bug: Error running "iex -S mix" when elixir/erlang plugins are set to system

Open
#158 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
528
Forks
79
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

I set the elixir and erlang plugins to "system" in the parent directory. When I try to run "iex -S mix" iex fails to start. If the plugins are set to versions managed by asdf, iex starts normally and executes the mix.exs script

### Steps to Reproduce

1. % asdf set -u erlang system
2. % asdf set -u elixir system
3. cd to any directory with an elixir project having a mix.exs file and no local .tools-version
4. % iex -S mix

### Expected Behaviour

iex should have started correctly. It does if asdf managed versions are set:

% asdf set -u erlang 28.0.1
% asdf set -u elixir 1.18.4-otp-28
% iex -S mix
Erlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

### Actual Behaviour

With erlang and elixir set to system, there's an error and iex doesn't start:

% iex -S mix
Erlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

** (SyntaxError) invalid syntax found on /Users/mpchase/.asdf/shims/mix:4:22:
error: syntax error before: "$@"

4 │ exec asdf exec "mix" "$@"
│ ^

└─ /Users/mpchase/.asdf/shims/mix:4:22
(elixir 1.18.4) lib/code.ex:1525: Code.require_file/2

### Environment

```shell
OS:
Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000 arm64

SHELL:
zsh 5.9 (arm64-apple-darwin24.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
0.18.0 (revision unknown)

ASDF INTERNAL VARIABLES:
ASDF_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/mpchase/.asdf
ASDF_CONFIG_FILE=/Users/mpchase/.asdfrc

ASDF INSTALLED PLUGINS:
elixir https://github.com/asdf-vm/asdf-elixir.git
89098d5c31fd3a240a25b1dacf881a6eeed426c4
erlang https://github.com/asdf-vm/asdf-erlang.git
5f27baa62864bb433be9c7f2f7d69b475f534376
```

### asdf plugins affected (if relevant)

% asdf list erlang
27.3.4
28.0.1

% asdf list elixir
1.18.4-otp-27
1.18.4-otp-28

% asdf current
Name Version Source Installed
elixir system /Users/mpchase/.tool-versions true
erlang system /Users/mpchase/.tool-versions true

iex is on my path:

% type -a iex
iex is /Users/mpchase/.asdf/shims/iex
iex is /opt/homebrew/bin/iex

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with system versions and an Elixir project containing mix.exs, then compare it with the asdf-managed versions. Start by inspecting the generated /Users/mpchase/.asdf/shims/mix and the iex and mix invocation paths; done means `iex -S mix` starts successfully in both configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, erlang, shell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.