diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index 8bff6f2c0..1660fc39b 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -325,10 +325,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir" `asdf` scripts need to be sourced **after** you have set your `$PATH` and **after** you have sourced your framework (oh-my-zsh etc). -::: warning -On macOS, starting a Bash or Zsh shell automatically calls a utility called `path_helper`. `path_helper` can rearrange items in `PATH` (and `MANPATH`), causing inconsistent behavior for tools that require specific ordering. To workaround this, `asdf` on macOS defaults to forcibly adding its `PATH`-entries to the front (taking highest priority). This is controllable with the `ASDF_FORCE_PREPEND` variable. -::: - Restart your shell so that `PATH` changes take effect. Opening a new terminal tab will usually do it. diff --git a/docs/ja-jp/guide/getting-started.md b/docs/ja-jp/guide/getting-started.md index ac6486fd0..f517af238 100644 --- a/docs/ja-jp/guide/getting-started.md +++ b/docs/ja-jp/guide/getting-started.md @@ -322,10 +322,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir" `asdf`のスクリプトは、`$PATH`を設定した**あと**、かつ、使用中のフレームワーク(oh-my-zsh など)を呼び出した**あと**に記述する必要があります。 -::: warning 警告 -macOSでは、BashまたはZSHシェルを起動すると、自動的に`path_helper`というユーティリティが呼び出されます。`path_helper`は`PATH`(および`MANPATH`)内の項目の順番を並び替えることができるため、特定の順序を必要とするツールの動作に一貫性が無くなってしまいます。これを回避するため、macOSで`asdf`を利用するときは強制的に`PATH`エントリの先頭に追加する(優先度を一番高くする)ようにしてください。これは、`ASDF_FORCE_PREPEND`環境変数で制御できます。 -::: - `PATH`の変更を反映するために、シェルを再起動してください。たいていの場合、ターミナルのタブを新たに開けばOKです。 diff --git a/docs/ja-jp/manage/configuration.md b/docs/ja-jp/manage/configuration.md index cad51b374..6d578d8c2 100644 --- a/docs/ja-jp/manage/configuration.md +++ b/docs/ja-jp/manage/configuration.md @@ -205,15 +205,6 @@ pre_foo_bar = echo Executing with args: $@ - 未設定の場合: asdf構成ファイルの`concurrency`の値が使用されます。 - 使用方法: `export ASDF_CONCURRENCY=32` -### `ASDF_FORCE_PREPEND` - -`asdf`のShimやパスのディレクトリを`PATH`の先頭(最高優先度)に追加するかどうかを設定します。 - -- 未設定の場合: macOSでのデフォルト値は`yes`、その他のシステムでのデフォルト値は`no`です。 -- `yes`の場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置します。 -- `yes`以外の文字列を設定した場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置することは _しません_ 。 -- Usage: `ASDF_FORCE_PREPEND=no . "/asdf.sh"` - ## 完全な構成の例 下記のように、asdfをシンプルにセットアップしたとします: diff --git a/docs/ko-kr/guide/getting-started.md b/docs/ko-kr/guide/getting-started.md index 93b296708..724d819b3 100644 --- a/docs/ko-kr/guide/getting-started.md +++ b/docs/ko-kr/guide/getting-started.md @@ -361,11 +361,7 @@ export ASDF_DIR="/opt/asdf-vm" ::: -`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다. - -::: 경고 -macOS에서, Bash 혹은 Zsh 셸 시작시에 자동적으로 `path_helper` 유틸리티를 실행시킵니다. `path_helper`는 `PATH` (와 `MANPATH`)에 항목들을 재배열 시켜 특정 순서를 요구하는 툴들의 일관된 동작을 방해합니다. 이를 방지하기 위해, macOS에서 `asdf`는 `PATH` 앞부분에 (가장 높은 우선순위) 강제로 추가합니다. 이는 `ASDF_FORCE_PREPEND`를 통해 변경가능합니다. -::: +`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다. `PATH` 업데이트를 위해 셸을 재시작하세요. 새로운 터미널을 여는 경우 대부분 해결됩니다. diff --git a/docs/ko-kr/manage/configuration.md b/docs/ko-kr/manage/configuration.md index 4d16fdd12..81c6736d1 100644 --- a/docs/ko-kr/manage/configuration.md +++ b/docs/ko-kr/manage/configuration.md @@ -211,15 +211,6 @@ pre_foo_bar = echo Executing with args: $@ - 미설정 시: asdf 설정 `concurrency` 값이 사용됩니다. - 사용법: `export ASDF_CONCURRENCY=32` -### `ASDF_FORCE_PREPEND` - -`PATH`의 맨 앞(최우선순위) 부분에 `asdf` shim과 경로 디렉토리를 추가할 것인지 여부. - -- 미설정 시: 맥 운영체제에서, `yes`가 기본값; 다른 시스템에서는 `no`가 기본값 -- `yes`: `PATH`의 앞 부분에 `asdf` 디렉토리 강제 추가 -- `yes` 이외의 _다른_ 문자열: `PATH`의 앞 부분에 `asdf` 디렉토리 강제로 추가하지 _않음_ -- 사용법: `ASDF_FORCE_PREPEND=no . "/asdf.sh"` - ## 전체 설정의 예시 다음을 이용한 간단한 asdf 설치는: diff --git a/docs/manage/configuration.md b/docs/manage/configuration.md index 3a283a447..88b3c7d0a 100644 --- a/docs/manage/configuration.md +++ b/docs/manage/configuration.md @@ -205,15 +205,6 @@ Number of cores to use when compiling the source code. If set, this value takes - If Unset: the asdf config `concurrency` value is used. - Usage: `export ASDF_CONCURRENCY=32` -### `ASDF_FORCE_PREPEND` - -Whether or not to prepend the `asdf` shims and path directories to the front-most (highest-priority) part of the `PATH`. - -- If Unset: On macOS, defaults to `yes`; but on other systems, defaults to `no` -- If `yes`: Force `asdf` directories to the front of the `PATH` -- If set to any string _other_ than `yes`: Do _not_ force `asdf` directories to the front of the `PATH` -- Usage: `ASDF_FORCE_PREPEND=no . "/asdf.sh"` - ## Full Configuration Example Following a simple asdf setup with: diff --git a/internal/config/config.go b/internal/config/config.go index 2395211e2..8f0797c89 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -16,7 +16,6 @@ import ( ) const ( - forcePrependDefault = false dataDirDefault = "~/.asdf" configFileDefault = "~/.asdfrc" defaultToolVersionsFilenameDefault = ".tool-versions" @@ -40,8 +39,7 @@ type Config struct { DefaultToolVersionsFilename string `env:"ASDF_DEFAULT_TOOL_VERSIONS_FILENAME, overwrite"` // Unclear if this value will be needed with the golang implementation. // AsdfDir string - DataDir string `env:"ASDF_DATA_DIR, overwrite"` - ForcePrepend bool + DataDir string `env:"ASDF_DATA_DIR, overwrite"` // Field that stores the settings struct if it is loaded Settings Settings PluginIndexURL string @@ -61,13 +59,7 @@ type Settings struct { } func defaultConfig(dataDir, configFile string) *Config { - forcePrepend := forcePrependDefault - forcePrependEnv := os.Getenv("ASDF_FORCE_PREPEND") - if strings.ToLower(forcePrependEnv) == "yes" || (forcePrependEnv == "" && runtime.GOOS == "darwin") { - forcePrepend = true - } return &Config{ - ForcePrepend: forcePrepend, DataDir: dataDir, ConfigFile: configFile, DefaultToolVersionsFilename: defaultToolVersionsFilenameDefault, diff --git a/internal/config/config_darwin_test.go b/internal/config/config_darwin_test.go deleted file mode 100644 index 5abf3568b..000000000 --- a/internal/config/config_darwin_test.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build darwin - -package config - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestLoadConfigEnv_WithForcePrependEnv_OnDarwin(t *testing.T) { - t.Run("When ASDF_FORCE_PREPEND env does not given on macOS", func(t *testing.T) { - config, _ := loadConfigEnv() - - assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true") - }) -} diff --git a/internal/config/config_linux_test.go b/internal/config/config_linux_test.go deleted file mode 100644 index f9e58d964..000000000 --- a/internal/config/config_linux_test.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build linux - -package config - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestLoadConfigEnv_WithForcePrependEnv_OnLinux(t *testing.T) { - t.Run("When ASDF_FORCE_PREPEND env does not given on Linux", func(t *testing.T) { - config, _ := loadConfigEnv() - - assert.False(t, config.ForcePrepend, "Then ForcePrepend property is false") - }) -} diff --git a/internal/config/config_test.go b/internal/config/config_test.go index cb4db5062..ebee2a13a 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -24,32 +24,6 @@ func TestLoadConfigEnv(t *testing.T) { assert.Zero(t, config.Home, "Shouldn't set Home property when loading config") } -func TestLoadConfigEnv_WithForcePrependEnv(t *testing.T) { - t.Run("When ASDF_FORCE_PREPEND env given yes", func(t *testing.T) { - t.Setenv("ASDF_FORCE_PREPEND", "yes") - - config, _ := loadConfigEnv() - - assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true") - }) - - t.Run("When ASDF_FORCE_PREPEND env given YES", func(t *testing.T) { - t.Setenv("ASDF_FORCE_PREPEND", "YES") - - config, _ := loadConfigEnv() - - assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true") - }) - - t.Run("When ASDF_FORCE_PREPEND env given any string other than yes", func(t *testing.T) { - t.Setenv("ASDF_FORCE_PREPEND", "no") - - config, _ := loadConfigEnv() - - assert.False(t, config.ForcePrepend, "Then ForcePrepend property is false") - }) -} - func TestLoadSettings(t *testing.T) { t.Run("When given invalid path returns error", func(t *testing.T) { settings, err := loadSettings("./foobar")