Reputation:
I am having trouble setting the Android_Home variable on my MacOS. I have the MacBook Pro 2016 edition. Can't seem to find .profile. I tried to create it but looks like it didn't take. Any thoughts?
Thanks. -Nathan
Upvotes: 1
Views: 5981
Reputation: 1806
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:
sudo touch ~/.zshrc
sudo nano ~/.zshrc
source ~/.zshrc
echo $PATH
Upvotes: 1
Reputation: 1717
Old school way to check if .bash_profile
file exists following could be done:
Finder>Go>COMPUTER>Mac HD>Users
, THEN click on your user account
.⌘ + ⇧ + .
, this will now display hidden files and folders. It will look something like this:In case the ⌘ + ⇧ + .
does not work, please look up the keyboard shortcut relevant for your Mac Operating system name.
Upvotes: 0
Reputation: 32
These line should be add to your Shell Initialization Files
:
export ANDROID_HOME=/Users/{YourUserName}/Library/Android/sdk
export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
bash
(by default), you should add these lines to your ~.bash_profile
or ~.bashrc
zsh
, you should add these lines to your ~/.zshrc
Upvotes: 1
Reputation: 4008
The file is called .bash_profile
and can be found in your home directory (/Users/<username>
)
To add your ANDROID_HOME
environment variable there, you would need to add the following line to your .bash_profile
export ANDROID_HOME=/path/to/android/sdk
To apply the changes, restart your terminal. Confirm that the changes have been applied by typing the following in your terminal:
echo $ANDROID_HOME
Your output should be /path/to/android/sdk
as entered above.
Upvotes: 4