Trying to add adb to PATH variable OSX

前端 未结 14 1223
遇见更好的自我
遇见更好的自我 2020-11-28 18:04

I am trying to develop for android and I want to add the adb to my PATH so that I can launch it really easily. I have added directories before by f

相关标签:
14条回答
  • 2020-11-28 18:21

    It appears that you're still trying to execute adb with ./adb. That asks the shell to run the program named adb in the current working directory.

    Try just adb without ./.

    0 讨论(0)
  • 2020-11-28 18:22

    On my Macbook Pro, I've added the export lines to ~/.bash_profile, not .profile.

    e.g.

    export PATH=/Users/me/android-sdk-mac_86/platform-tools:/Users/me/android-sdk-mac_86/tools:$PATH
    
    0 讨论(0)
  • 2020-11-28 18:23

    Why are you trying to run "./adb"? That skips the path variable entirely and only looks for "adb" in the current directory. Try running "adb" instead.

    Edit: your path looks wrong. You say you get

    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Libs/android-sdk-mac_x86/tools:/Libs/android-sdk-mac_x86/platform-tools
    

    You're missing the /Users/simon part.

    Also note that if you have both .profile and .bash_profile files, only the latter gets executed.

    0 讨论(0)
  • 2020-11-28 18:24

    2nd solution is explained below. But when i close the terminal the change which i made in path variable gets lost. Thus i prefer the first way!

    0 讨论(0)
  • 2020-11-28 18:33

    Just encase anyone finds this SO post when using Android Studio which includes the SDK has part of the App package (on Mac OSX).

    So as @davecaunt and @user1281750 noted but insert the following line to .bash_profile

    export PATH=/Applications/Android\ Studio.app/sdk/tools:/Applications/Android\ Studio.app/sdk/platform-tools:$PATH
    
    0 讨论(0)
  • 2020-11-28 18:33

    The answer for MAC should be:

    1. Open your bash_profile with the following commands: open ~/.bash_profile

    2. In case base profile file doesn't exist, create a new one with the following command: touch .bash_profile then repeat phase 1.

    3. Add the following line: export PATH=/Users/"YOURUSER"/Library/Android/sdk/platform-tools:$PATH

    4. Restart your bash window and test by typing adb shell

    Good luck! :-)

    0 讨论(0)
提交回复
热议问题