背景:配置了Android Studio adb 路徑后拯钻,再次使用終端命令時(shí),提示
command not found
辩尊,除了cd
命令能使用之外涛浙,其他一律不能使用!
解決方案:
1,打開終端轿亮,執(zhí)行下面一句命令疮薇,能暫時(shí)啟用所有的終端命令:
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin
2,進(jìn)入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