背景:配置了Android Studio adb 路徑后,再次使用終端命令時,提示
command not found,除了cd命令能使用之外,其他一律不能使用!
解決方案:
1,打開終端,執(zhí)行下面一句命令,能暫時啟用所有的終端命令:
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
2,進入Home,執(zhí)行命令:
cd ~
3,創(chuàng)建文件,執(zhí)行命令:
touch .bash_profile
4,打開并編輯bash_profile 執(zhí)行命令:
open .bash_profile
5,編輯
<!--jdk配置-->
JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME PATH CLASSPATH
<!--終端命令-->
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
<!--adb 配置-->
PATH="/Users/xxx/Library/Android/sdk/platform-tools:${PATH}"
export PATH
備注:TOOLS_PATH和JAVA_HOME配置成自己的路徑,PATH中多個path路徑用 :隔開。
6,保存 command + s,并執(zhí)行命令
source .bash_profile