0

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?

Saif Siddiqui
  • 856
  • 1
  • 13
  • 33

4 Answers4

0

This is not an Appium issue. Your environment is not saved in your profile.

~/.bash_profile is sourced by bash when we start in interactive login mode. That is typically only when you login at the console.

When you log in graphically, ~/.profile will be specifically sourced by the script that launches terminal. So ~/.bash_profile is not sourced .

You should save your environment settings in ~/.bash.profile instead

john
  • 413
  • 7
  • 16
0

You should set the required env vars in either .bash_profile or .zshrc files located in your users dir depending on if you are using bash or zsh as your choice of shell on mac/linux

Follow this by executing source ~/.bash_profile and the next time you open the terminal these configs should apply.

Sample config for android home:

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
0

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

Saif Siddiqui
  • 856
  • 1
  • 13
  • 33
0

If you are setting up the ANDROID_HOME environment variable on macOS Catalina, .bash_profile is no longer Apple's default shell, and it won't persist your path variables. Use .zprofile instead and follow the environment setup instructions in react-native documentation or others. .bash_profile will keep creating new file which won't make the path permanent or persist on closing the terminal on your system path.

To create a new path just do this in macOS Big Sur:

  1. sudo touch ~/.zshrc
  2. sudo nano ~/.zshrc
  3. export all the path
  4. ctrl + x and save
  5. source ~/.zshrc
  6. Check with echo $PATH
Bhavya Koshiya
  • 1,262
  • 2
  • 8
  • 22