Skip to content

asdf は 0.16 からディレクトリ構造が大幅に変化している

asdf は様々なランタイムを管理出来るバージョンマネージャです。 Golang で実装されています。 ただ、後発の Rust で実装された mise (旧名は rtx) は「asdf 用のプラグインは全て使えるが、asdf より速い」とうたっています。 これを受けてなのか、asdf は バージョン 0.16.0 の Changelog に下記の記載があります。 記載内容によると「バージョン 0.16.0 からより速く、シンプルで、メンテナンスし易いように書き直した」ようです。

Rewrite asdf in Golang The rewrite in Go was spread across 88 pull requests that are all included in this release. The primary goal of the rewrite was to create a codebase that was faster, simpler and easier to maintain. The rewrite tries to maintain feature parity with the previous version. However, a number of breaking changes were introduced. Some of these were due to the change of language, a few out of a desire to simplify the code, and some to improve the user experience. For the full list of breaking changes and the upgrade guide visit the Upgrading to 0.16.0 page on the asdf website. It is highly recommended that you read this guide before upgrading.

ですが、私の macOS 環境では 0.15 系から 0.16.1 へバージョンアップしたところ、下記のエラーが出るようになってしまいました。

/Users/USERNAME/.zshrc:.:10: no such file or directory: /opt/homebrew/opt/asdf/libexec/asdf.sh

.zshrc では バージョン 0.15 までのガイド に従って以下のように設定してありましたが、これがエラーになっているようです。

.zshrc
# asdf
. /opt/homebrew/opt/asdf/libexec/asdf.sh

検証環境

対象 バージョン
macOS 15.3

バージョン 0.16 以前と以降での、ディレクトリ構造の違い

「asdf のバージョン 0.16 以前」と「以降」では大きくディレクトリ構造が異なります。 0.16.1 では前述のエラーになっていた /opt/homebrew/opt/asdf/libexec/asdf.sh が存在しません。

バージョン 0.14.1

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
~$ tree /opt/homebrew/opt/asdf/
/opt/homebrew/opt/asdf/
├── CHANGELOG.md
├── INSTALL_RECEIPT.json
├── LICENSE
├── README.md
├── bin
│   └── asdf
├── etc
│   └── bash_completion.d
│       └── asdf.bash
├── libexec
│   ├── CONTRIBUTING.md
│   ├── SECURITY.md
│   ├── asdf.elv
│   ├── asdf.fish
│   ├── asdf.nu
│   ├── asdf.ps1
│   ├── asdf.sh
│   ├── asdf_updates_disabled
│   ├── ballad-of-asdf.md
│   ├── bin
│   │   ├── asdf
│   │   └── private
│   │       └── asdf-exec
│   ├── completions
│   ├── defaults
│   ├── docs
│   │   ├── CNAME
│   │   ├── contribute
│   │   │   ├── core.md
│   │   │   ├── documentation.md
│   │   │   ├── first-party-plugins.md
│   │   │   └── github-actions.md
│   │   ├── guide
│   │   │   ├── getting-started.md
│   │   │   └── introduction.md
│   │   ├── index.md
│   │   ├── ja-jp
│   │   │   ├── contribute
│   │   │   │   ├── core.md
│   │   │   │   ├── documentation.md
│   │   │   │   ├── first-party-plugins.md
│   │   │   │   └── github-actions.md
│   │   │   ├── guide
│   │   │   │   ├── getting-started.md
│   │   │   │   └── introduction.md
│   │   │   ├── index.md
│   │   │   ├── manage
│   │   │   │   ├── commands.md
│   │   │   │   ├── configuration.md
│   │   │   │   ├── core.md
│   │   │   │   ├── plugins.md
│   │   │   │   └── versions.md
│   │   │   ├── more
│   │   │   │   ├── community-projects.md
│   │   │   │   ├── faq.md
│   │   │   │   └── thanks.md
│   │   │   └── plugins
│   │   │       └── create.md
│   │   ├── manage
│   │   │   ├── commands.md
│   │   │   ├── configuration.md
│   │   │   ├── core.md
│   │   │   ├── plugins.md
│   │   │   └── versions.md
│   │   ├── more
│   │   │   ├── community-projects.md
│   │   │   ├── faq.md
│   │   │   └── thanks.md
│   │   ├── package-lock.json
│   │   ├── package.json
│   │   ├── plugins
│   │   │   └── create.md
│   │   ├── pt-br
│   │   │   ├── contribute
│   │   │   │   ├── core.md
│   │   │   │   ├── documentation.md
│   │   │   │   ├── first-party-plugins.md
│   │   │   │   └── github-actions.md
│   │   │   ├── guide
│   │   │   │   ├── getting-started.md
│   │   │   │   └── introduction.md
│   │   │   ├── index.md
│   │   │   ├── manage
│   │   │   │   ├── commands.md
│   │   │   │   ├── configuration.md
│   │   │   │   ├── core.md
│   │   │   │   ├── plugins.md
│   │   │   │   └── versions.md
│   │   │   ├── more
│   │   │   │   ├── community-projects.md
│   │   │   │   ├── faq.md
│   │   │   │   └── thanks.md
│   │   │   └── plugins
│   │   │       └── create.md
│   │   └── zh-hans
│   │       ├── contribute
│   │       │   ├── core.md
│   │       │   ├── documentation.md
│   │       │   ├── first-party-plugins.md
│   │       │   └── github-actions.md
│   │       ├── guide
│   │       │   ├── getting-started.md
│   │       │   └── introduction.md
│   │       ├── index.md
│   │       ├── manage
│   │       │   ├── commands.md
│   │       │   ├── configuration.md
│   │       │   ├── core.md
│   │       │   ├── plugins.md
│   │       │   └── versions.md
│   │       ├── more
│   │       │   ├── community-projects.md
│   │       │   ├── faq.md
│   │       │   └── thanks.md
│   │       └── plugins
│   │           └── create.md
│   ├── help.txt
│   ├── lib
│   │   ├── commands
│   │   │   ├── command-current.bash
│   │   │   ├── command-env.bash
│   │   │   ├── command-exec.bash
│   │   │   ├── command-export-shell-version.bash
│   │   │   ├── command-global.bash
│   │   │   ├── command-help.bash
│   │   │   ├── command-info.bash
│   │   │   ├── command-install.bash
│   │   │   ├── command-latest.bash
│   │   │   ├── command-list-all.bash
│   │   │   ├── command-list.bash
│   │   │   ├── command-local.bash
│   │   │   ├── command-plugin-add.bash
│   │   │   ├── command-plugin-list-all.bash
│   │   │   ├── command-plugin-list.bash
│   │   │   ├── command-plugin-push.bash
│   │   │   ├── command-plugin-remove.bash
│   │   │   ├── command-plugin-test.bash
│   │   │   ├── command-plugin-update.bash
│   │   │   ├── command-reshim.bash
│   │   │   ├── command-shim-versions.bash
│   │   │   ├── command-uninstall.bash
│   │   │   ├── command-update.bash
│   │   │   ├── command-version.bash
│   │   │   ├── command-where.bash
│   │   │   ├── command-which.bash
│   │   │   ├── reshim.bash
│   │   │   └── version_commands.bash
│   │   ├── functions
│   │   │   ├── installs.bash
│   │   │   ├── plugins.bash
│   │   │   └── versions.bash
│   │   └── utils.bash
│   ├── scripts
│   │   ├── checkstyle.py
│   │   ├── install_dependencies.bash
│   │   ├── lint.bash
│   │   └── test.bash
│   ├── test
│   │   ├── asdf_elvish.bats
│   │   ├── asdf_fish.bats
│   │   ├── asdf_nu.bats
│   │   ├── asdf_pwsh.bats
│   │   ├── asdf_sh.bats
│   │   ├── banned_commands.bats
│   │   ├── current_command.bats
│   │   ├── fixtures
│   │   │   ├── dummy_broken_plugin
│   │   │   │   └── bin
│   │   │   │       ├── download
│   │   │   │       ├── install
│   │   │   │       └── list-all
│   │   │   ├── dummy_legacy_plugin
│   │   │   │   └── bin
│   │   │   │       ├── get-version-from-legacy-file
│   │   │   │       ├── install
│   │   │   │       ├── list-all
│   │   │   │       ├── list-legacy-filenames
│   │   │   │       └── parse-legacy-file
│   │   │   ├── dummy_plugin
│   │   │   │   ├── LICENSE
│   │   │   │   └── bin
│   │   │   │       ├── download
│   │   │   │       ├── get-version-from-legacy-file
│   │   │   │       ├── help.overview
│   │   │   │       ├── install
│   │   │   │       ├── latest-stable
│   │   │   │       ├── list-all
│   │   │   │       ├── list-legacy-filenames
│   │   │   │       ├── parse-legacy-file
│   │   │   │       ├── post-plugin-add
│   │   │   │       ├── post-plugin-update
│   │   │   │       └── pre-plugin-remove
│   │   │   ├── dummy_plugin_no_download
│   │   │   │   ├── LICENSE
│   │   │   │   └── bin
│   │   │   │       └── install
│   │   │   └── dummy_plugins_repo
│   │   │       └── plugins
│   │   │           ├── bar
│   │   │           ├── dummy
│   │   │           └── foo
│   │   ├── get_asdf_config_value.bats
│   │   ├── help_command.bats
│   │   ├── info_command.bats
│   │   ├── install_command.bats
│   │   ├── latest_command.bats
│   │   ├── list_command.bats
│   │   ├── plugin_add_command.bats
│   │   ├── plugin_extension_command.bats
│   │   ├── plugin_list_all_command.bats
│   │   ├── plugin_remove_command.bats
│   │   ├── plugin_test_command.bats
│   │   ├── plugin_update_command.bats
│   │   ├── remove_command.bats
│   │   ├── reshim_command.bats
│   │   ├── setup_suite.bash
│   │   ├── shim_env_command.bats
│   │   ├── shim_exec.bats
│   │   ├── shim_versions_command.bats
│   │   ├── test_helpers.bash
│   │   ├── uninstall_command.bats
│   │   ├── update_command.bats
│   │   ├── utils.bats
│   │   ├── version_commands.bats
│   │   ├── where_command.bats
│   │   └── which_command.bats
│   └── version.txt
├── sbom.spdx.json
└── share
    ├── fish
    │   └── vendor_completions.d
    │       └── asdf.fish
    └── zsh
        └── site-functions
            └── _asdf

53 directories, 183 files

バージョン 0.16.1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
% tree /opt/homebrew/opt/asdf/
/opt/homebrew/opt/asdf/
├── CHANGELOG.md
├── INSTALL_RECEIPT.json
├── LICENSE
├── README.md
├── bin
│   └── asdf
├── etc
│   └── bash_completion.d
│       └── asdf
├── sbom.spdx.json
└── share
    ├── fish
    │   └── vendor_completions.d
    │       └── asdf.fish
    └── zsh
        └── site-functions
            └── _asdf

9 directories, 9 files

homebrew で 0.16 系をインストールする

homebrew を使い、zsh や bash 環境で asdf をインストールしたログは以下の通りです。 従来はインストール後に「シェル毎の環境変数を追加」するガイドが表示されていたのですが、バージョン 0.16 からは表示されなくなりました。

zsh でのインストールログ

% brew install asdf
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/manifests/0.16.1
Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/downloads/1b752e8b08e1066b848f2ca35441286f66ef53aa49e520801ff0c0670ee42618--asdf-0.16.1.bottle_manifest.json
==> Fetching asdf
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/blobs/sha256:444c8ec5fa55d551794c4bf6d4374ddbc58298706a6843d29320dbd5c04284f3
Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/downloads/43cfbfcd372314769da80b0464c4e75de247a218440531d544389251e3cf4497--asdf--0.16.1.arm64_sequoia.bottle.tar.gz
==> Pouring asdf--0.16.1.arm64_sequoia.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/asdf/0.16.1: 10 files, 10.9MB
==> Running `brew cleanup asdf`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

bash でのインストールログ

~$ brew install asdf
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/manifests/0.16.1
Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/downloads/1b752e8b08e1066b848f2ca35441286f66ef53aa49e520801ff0c0670ee42618--asdf-0.16.1.bottle_manifest.json
==> Fetching asdf
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/blobs/sha256:444c8ec5fa55d551794c4bf6d4374ddbc58298706a6843d29320dbd5c04284f3
Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/downloads/43cfbfcd372314769da80b0464c4e75de247a218440531d544389251e3cf4497--asdf--0.16.1.arm64_sequoia.bottle.tar.gz
==> Pouring asdf--0.16.1.arm64_sequoia.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d
==> Summary
🍺  /opt/homebrew/Cellar/asdf/0.16.1: 10 files, 10.9MB
==> Running `brew cleanup asdf`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

結論

冒頭に記載したように、0.16 以前のバージョンから 0.16 以降へバージョンアップしたところ、以下のエラーが出ていました。

/Users/USERNAME/.zshrc:.:10: no such file or directory: /opt/homebrew/opt/asdf/libexec/asdf.sh

このエラーを解消するにはシェルごとに ~/.bash_profile~/.zshrc で定義した asdf 用の環境変数を削除した上で、homebrew で asdf を再インストールすれば良さそうです。 バージョン 0.16 以前にインストールしていた asdf 用のプラグインも使えているようです。

brew uninstall asdf
brew install asdf