我正在使用 macOS 12 Monterey 和 bash shell。
.bash_profile
#Default PATH entries
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Applications/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Applications/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Applications/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Applications/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# Added by Toolbox App
export PATH="$PATH:/Users/mah_prince/Library/Application Support/JetBrains/Toolbox/scripts"eval $(/opt/homebrew/bin/brew shellenv)
.bash_profile.bak
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/mah_prince/.bash_profile
eval $(/opt/homebrew/bin/brew shellenv)
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Applications/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Applications/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Applications/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Applications/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
當我輸入echo $PATH它回傳
/opt/homebrew/bin:/opt/homebrew/sbin:"/opt/homebrew/bin:/opt/homebrew/sbin${PATH :$PATH}";
很多 mac 命令也不可用,比如which。另外,我安裝的 nodejs、npm 不可用。
但是如果我輸入
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
然后設定 PATH 并且所有命令都再次可用。
但是,如果我重新啟動筆記本電腦,PATH 將再次重置為以前的路徑,并且命令也不再可用,我的 nodejs 也是如此。
uj5u.com熱心網友回復:
改變
export PATH="$PATH:/Users/mah_prince/Library/Application Support/JetBrains/Toolbox/scripts"eval $(/opt/homebrew/bin/brew shellenv)
至
export PATH="$PATH:/Users/mah_prince/Library/Application Support/JetBrains/Toolbox/scripts"
eval $(/opt/homebrew/bin/brew shellenv)
這eval命令應位于單獨的行上。
我懷疑您.bash_profile沒有以換行符結尾,并且添加eval命令的工具不會檢查這一點,因此它將它添加到行尾而不是下一行。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/511307.html
標籤:重击苹果系统小路
上一篇:MacOS應用程式啟動事件?
