Building AOSP on macOS

After going through enormous threads of posts on xda developers and Android documentation it was pretty evident for me to write a tutorial for building AOSP on mac. I have been trying to build ASOP for some time now and hitting walls on some point or the other. This article came to rescue: Thanks, Chris!

So, all the steps are pretty much from his guide although I would add some nuances to what issues you might face based on your macOS versions.

My environment:

  • OS: macOS Mojave 10.14.5
  • CPU: 2,8 GHz Intel Core i7 (influence the speed compilation)
  • RAM: 16 GB 2133 MHz DDR3 (8GB minimum, recommended 16GB)
  • Disk: 200GB free space (after AOSP sources downloaded — minimum 200GB)
  • Device: Nexus 5X (bullhead)

I have linked to the actual tutorial above you can follow the steps. I will walkthrough some issues I encountered while following the setup process. Folks, low on disk space can move the android.image the file you generate when following the steps to an external HDD or SSD and mount the file using hdiutils while you work on your ROM. Following are some issues and how to resolve them.


  1. Mac OS SDK issues: You will probably hit errors when trying to run make commands. To fix this issue, download the MacOS SDK version supported by the branch you are building. Supported versions are (10.8, 10.9, 10.10, 10.11). You can download one of the SDKs here:, Thanks to my friend Ramsudharsan, follow him here: To install a MacOSSDK, download the zipped sources, extract them. You should see a folder named MacOSX<version>.sdk. Open finder and go to Applications, find Xcode. Right-click on Xcode select Show Package Contents.
  2. GnuPG package is now gnupg2, so this command should install GnuPG: sudo port install gnupg2
  3. In case of an incompatible bison binary file, you might see an error tracing to BISON_PKGDATADIR=, follow this:

Happy ROM cooking! Leave your comments down if you need more assistance.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.