Search code examples
macosunixterminalappiumjava-home

To set Android_Home and JAVA_HOME variable every-time need to run "source ~/.profile" for Appium on MAC


I am trying to Run Appium on MAC OS Mojave. To see if my configuration is good I am using Appium Doctor. It shows my ANDROID_HOME and JAVA_HOME is not set.

enter image description here

Once I set them in ~/.profile Appium Doctor shows all green that is everything is good.

Now the problem is every time I want to create new Appium Session or I close the terminal, then every-time I need to run "source ~/.profile" Previously the setup was working fine.

enter image description here

How to solve this problem?


Solution

  • Two Solution worked for me :

    1st

    Create Environment variable like Java_home and Android_Home in the IDE itself like if you are using intelliJ refer: Setting up and using environment variables in IntelliJ Idea

    2nd

    Create a new file ~/.zprofile
    Type there source ~/.bash_profile
    Save and close
    

    Now the environment should be saved in the profile and Appium configuration should be saved automatically