Open AndroidStudio project from command line on OSX

前端 未结 7 1319
眼角桃花
眼角桃花 2020-12-13 03:12

I would like to open an AndroidStudio project from the command line on my Mac. Something like:

~ $ AndroidStudio --path ~/my_android_project
<
7条回答
  •  盖世英雄少女心
    2020-12-13 03:51

    For Mac users:

    If you are using bach:

    • Open Terminal and cd to ~ like this: cd ~
    • Open the .bach_profile file with this command: open .bach_profile
    • Add the following line in the .bach_profile file:
      alias NAMEYOUWANT="/Applications/Android\ Studio.app" for example alias android="/Applications/Android\ Studio.app"
    • Save file and restart Terminal.

    If you are using zsh:

    • Open Terminal and cd to ~ like this: cd ~
    • Open the .zshrc file with this command: open .zshrc
    • Add the following line in the .zshrc file:
      alias NAMEYOUWANT="/Applications/Android\ Studio.app" for example alias android="/Applications/Android\ Studio.app"
    • Save file and restart Terminal.

    You can now open a project with Android Studio using this command:
    open . -a NAMEYOUWANT (with our example it would be: open . -a android)

    You can follow these steps to create any alias like opening Xcode, Visual Studio or even shortcut git commands.

提交回复
热议问题