[Mac] 無法 cd 進入 ~/Library/Application Support 目錄?
不知從何時開始,在 iTerm 裡面,
想要進入 ~/Library/Application Support 目錄時都會出錯,
而且錯誤訊息看起來是想要進去 Application 目錄:
$ cd ~/Library/Application\ Support/
-bash: cd: /Users/testuser/Library/Application: No such file or directory
$ cd ~/Library/Application\ Support/
-bash: cd: /Users/testuser/Library/Application: No such file or directory
$ cd ~/Library/Application\ Support/ -bash: cd: /Users/testuser/Library/Application: No such file or directory
找了半天,一直沒有結果。
問了 ChatGPT,給了我一堆可能的問題,
照著試過了權限等等的檢測或修改,也都沒什麼用…
後來在 StackExchange 上找到一個可能的解法,
有人提到了 cd
這個指令可能被包裝過了?!
執行 type cd
看看,果真是個函式,
而且看內容,像是 gvm 這個我之前安裝,用來選擇 Go 版本的工具:
$ type cd
cd is a function
cd ()
{
if __gvm_is_function __gvm_oldcd; then
__gvm_oldcd $*;
fi;
local dot_go_version dot_go_pkgset rslt;
local defaults_go_name defaults_go_pkgset;
......
return 0
}
$ type cd
cd is a function
cd ()
{
if __gvm_is_function __gvm_oldcd; then
__gvm_oldcd $*;
fi;
local dot_go_version dot_go_pkgset rslt;
local defaults_go_name defaults_go_pkgset;
......
return 0
}
$ type cd cd is a function cd () { if __gvm_is_function __gvm_oldcd; then __gvm_oldcd $*; fi; local dot_go_version dot_go_pkgset rslt; local defaults_go_name defaults_go_pkgset; ...... return 0 }
試試看能不能用原本的 cd
指令,結果真的可以!
builtin cd ~/Library/Application\ Support/
builtin cd ~/Library/Application\ Support/
builtin cd ~/Library/Application\ Support/
感覺上可能是 gvm 修改過 cd
但可能有些問題,
所以導致目錄名稱有空白的話,它就會出錯…
不過至少現在有個 workaround 囉~
(本頁面已被瀏覽過 19 次)