-
Notifications
You must be signed in to change notification settings - Fork 521
Bazel Setup Instructions for Mac
The steps to install Bazel on Mac are:
- Set up Rosetta Terminal
- Install Bazel
- Set Bazel and ANDROID_HOME paths permanently in your terminal
- Verify that the build is working
- In the Finder app on your Mac, locate the Applications folder from the favorites sidebar.
- Right-click on your Terminal app and create a duplicate Terminal (and rename it accordingly, say Terminal Rosetta, to avoid confusion).
- On the newly created Terminal Rosetta icon, right-click and select "Get info", and under “General”, check the option "Open using Rosetta".
Note: Always use the Rosetta terminal for Bazel setup and running bash setup.sh
or any Bazel build-related commands.
-
Install Bazel following the instructions here. Make sure that you follow the instructions for installing a specific version (Oppia Android requires 6.5.0 and won't build on other versions).
-
That’s it, now Bazel is installed, and you can verify it by running the command:
bazel --version
- Expected Output
bazel 6.5.0
- To set the
Bazel
andANDROID_HOME
path permanently in your terminal run these commands:sudo nano /etc/paths
- Enter your password, when prompted.
- Go to the bottom of the file, and enter these paths
/Users/{YourMacUserName}/bin $HOME/Library/Android/sdk
- Hit control-x to quit.
- Enter “Y” to save the modified buffer.
- That’s it! To test it, in a new terminal window, type:
echo $PATH
Note: You must set the path for Bazel
and ANDROID_HOME
before running bazel build for oppia-android, otherwise you will get an error.
At this point, your system should be able to build Oppia Android. To verify, try building the APK (from your subsystem terminal -- note that this and all other Bazel commands must be run from the root of the ‘oppia-android’ directory otherwise they will fail):
bazel build //:oppia_dev
(Note that this command may take 10-20 minutes to complete depending on the performance of your machine).
If everything is working, you should see output like the following:
Target //:oppia_dev up-to-date:
bazel-bin/oppia_dev.aab
INFO: Elapsed time: ...
INFO: 1 process...
INFO: Build completed successfully, ...
Note also that the oppia_dev.aab
under the bazel-bin
directory of your local copy of Oppia Android should be a fully functioning development version of the app that can be installed using bundle-tool. However, it's recommended to deploy Oppia to an emulator or connected device using the following Bazel command:
bazel run //:install_oppia_dev
Have an idea for how to improve the wiki? Please help make our documentation better by following our instructions for contributing to the wiki.
Core documentation
Developing Oppia
- Contributing to Oppia Android
- Bazel
- Key Workflows
- Testing
- Developing Skills
- Frequent Errors and Solutions
- RTL Guidelines
- Working on UI
- Writing Design Docs
Developer Reference
- Code style
- Background Processing
- Dark mode
- Buf Guide
- Firebase Console Guide
- Platform Parameters & Feature Flags
- Work Manager
- Dependency Injection with Dagger
- Revert & regression policy
- Upgrading target SDK version
- Spotlight Guide
- Triaging Process
- Bazel
- Internationalization
- Terminology in Oppia
- Past Events