Linux

homebrew로 설치한 asdf-vm을 업데이트 한 이후에 asdf로 설치한 프로그램들의 동작이 안되는 문제

gilchris 2023. 11. 17. 16:26

homebrew로 asdf-vm을 설치하고 나서 asdf로 프로그램들을 설치해서 쓰다가 homebrew로 asdf를 업데이트 하고 나면 asdf로 설치한 프로그램들이 동작이 안되는 경우가 있다.

보통은 명확하게 업데이트 이후에 동작이 안된다고 인지하기 보다는 그냥 아래와 같은 에러 메세지를 어느날 갑자기 보게된다.

/Users/myhome/.asdf/shims/node: line 8: /opt/homebrew/Cellar/asdf/0.10.2/libexec/bin/asdf: No such file or directory
/Users/myhome/.asdf/shims/node: line 8: exec: /opt/homebrew/Cellar/asdf/0.10.2/libexec/bin/asdf: cannot execute: No such file or directory

~/.asdf/shims 밑에 들어있는 것들은 그냥 배쉬 쉘 스크립트이고 발생하는 에러는 그냥 경로가 안맞는 것 뿐이니 해당 파일을 열어서 경로를 맞춰주면 된다.

아래는 ~/.asdf/shims 하위에 있는 모든 파일에서 버전 정보를 고치는 스크립트이다. 0.13.1 부분 값을 현재 설치된 asdf 버전으로 맞추고 실행하면 된다.

find ~/.asdf/shims -type f -exec sed -i '' 's|/opt/homebrew/Cellar/asdf/.*/libexec/bin/asdf|/opt/homebrew/Cellar/asdf/0.13.1/libexec/bin/asdf|g' {} +