Skip to content

Commit

Permalink
Add ZSH config for setting environment variables on macOS Catalina an…
Browse files Browse the repository at this point in the history
…d newer

- On macOS Catalina and newer, Apple switched from Bash to ZSH. The new file for ".bash_profile" is ".zprofile".
- Add samples for the Android-SDK path on macOS and Linux
- Name Linux first and then macOS

Co-Authored-By: エリス <[email protected]>
  • Loading branch information
GitToTheHub and erisu committed Nov 7, 2024
1 parent e0344df commit fd4dc34
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions www/docs/en/dev/guide/platforms/android/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,50 @@ It is also recommended to update the `PATH` environment variable to include the

_**Note:** The directories above are generally located in the Android SDK ROOT._

#### macOS and Linux
#### Linux and macOS

On a Mac or Linux, with a text editor, create or modify the `~/.bash_profile` file.
On Linux or macOS versions prior to Catalina, use any text editor to create or modify the `~/.bash_profile` file.
<br>On macOS Catalina and newer, create or modify the `~/.zprofile` file, as the default shell has changed.

To set an environment variable, add a line that uses `export` like so (substitute the path with your local installation):
Add the following line to your shell's profile to set up the `ANDROID_HOME` environment variable.

**Linux:**

```bash
export ANDROID_HOME=/Development/android-sdk/
export ANDROID_HOME=~/Android/Sdk
```

To update your `PATH`, add a line resembling the following (substitute the paths with your local Android SDK installation's location):
**macOS:**

```bash
export ANDROID_HOME=~/Library/Android/sdk
```

The above examples point to the standard paths where the Android SDK is typically stored. Depending on your environment configuration, the path may differ. Be sure to confirm that the path exist or adjust them to match your local installation.

After setting the `ANDROID_HOME` environment variable, update the `PATH` variable to include directories containing various Android-related binaries.

```bash
export PATH=$PATH:$ANDROID_HOME/platform-tools/
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$ANDROID_HOME/build-tools/
export PATH=$PATH:$ANDROID_HOME/emulator/
```

Reload your terminal to see this change reflected or run the following command:

**Linux and macOS older then Catalina:**

```bash
source ~/.bash_profile
```

**macOS Catalina and newer:**

```bash
source ~/.zprofile
```

#### Windows

These steps may vary depending on your installed version of Windows. Close and reopen any command prompt windows after making changes to see them reflected.
Expand Down

0 comments on commit fd4dc34

Please sign in to comment.