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: https://medium.com/@christopherney/building-android-o-with-a-mac-da07e8bd94f9. 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.

Issues:

  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: https://github.com/phracker/MacOSX-SDKs/releases, Thanks to my friend Ramsudharsan, follow him here: https://github.com/ramsudharsan. 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: https://alset0326.github.io/aosp-on-macos-high-sierra.html

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

Aditya Karnam
Leave a Reply

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