Skip to content

Dependencies for Mac

Carlos Arriaga edited this page Jan 2, 2018 · 1 revision

Mac OS X

Special tutorial How to build on MAC OS (for example Mac OS yosemite 10.10.4)

Creating a case-sensitive disk image You can also create it from a shell with the following command:

 hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 60g ~/android.dmg

This will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for Android development.

If you need a larger volume later, you can also resize the sparse image with the following command:

 hdiutil resize -size <new-size-you-want>g ~/android.dmg.sparseimage

For a disk image named android.dmg stored in your home directory, you can add helper functions to your ~/.bash_profile: To mount the image when you execute mountAndroid:

*mount the android file image function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }

Note: If your system created a .dmg.sparsefile file, replace ~/android.dmg with ~/android.dmg.sparsefile. To unmount it when you execute umountAndroid:

unmount the android file image

 function umountAndroid() { hdiutil detach /Volumes/android; }

Once you've mounted the android volume, you'll do all your work there. You can eject it (unmount it) just like you would with an external drive.

Install MacPorts from [macports.org] (http://www.macports.org/install.php.) in terminal write:

export PATH=/opt/local/bin:$PATH

POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg

if you use mac os 10.4 also install this

POSIXLY_CORRECT=1 sudo port install bison

Setting a file descriptor limit

On Mac OS, the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit. To increase the cap, add the following lines to your ~/.bash_profile:

set the number of open files to be 1024

ulimit -S -n 1024

Downloading the source

 cd /Volumes/android

 mkdir ~/bin
 PATH=~/bin:$PATH
 curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
 chmod a+x ~/bin/repo

 repo init -u https://github.com/XPerience-AOSP-Lollipop/Manifest -b xpe-12.0
 repo sync

Generating the keys

{% include note.html content="You only need to run this once. If you ever rerun these, you'll need to migrate between builds - see [Changing keys]" %}

From the root of your Android tree, run these commands, altering the subject line to reflect your information:

$ subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
$ mkdir ~/.android-certs
$ for x in releasekey platform shared media; do \
    ./development/tools/make_key ~/.android-certs/$x "$subject"; \
done

You should keep these keys safe, and store the passphrase in a secure location.

Generating an install package

{% include tip.html content="If you wish to preserve your data coming from a Lineage build you didn't build, see [Changing keys]." %}

Generating and signing target files

After following the build instructions for your device, instead of running brunch <codename>, run the following:

$ breakfast <codename>
$ mka target-files-package dist

Sit back and wait for a while - it may take a while depending on your computer's specs. After it's finished, you just need to sign all the APKs:

$ croot
$ ./build/tools/releasetools/sign_target_files_apks -o -d ~/.android-certs \
    out/dist/*-target_files-*.zip \
    signed-target_files.zip

Generating the install package

Now, to generate the installable zip, run:

$ ./build/tools/releasetools/ota_from_target_files -k ~/.android-certs/releasekey \
    --block --backup=true \
    signed-target_files.zip \
    signed-ota_update.zip

Then, install the zip in recovery as you normally would.

NOTE:

if you are old linux user and nano are familiar for you (like me xD) you need change this to

 git config --global core.editor nano

and you can use like linux commands :)

#NOTE 2 #

if you have problems related to gnu-sed ("GNU sed is required for Darwin builds, please install and add 'gsed' to the path")

install brew and follow this tap in terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ow, we need to run a few commands through Brew, just to make sure everything is installed correctly. Enter the following into the Terminal: Code: brew outdated && brew update && brew upgrade && brew doctor

now you can use brew

 brew install gnu-sed gnupg pngcrush

Now for build you need MAVEN is easy install on linux but on mac YOU need homebrew installed then

 brew install maven

Needed to execute some GNU binary

 brew install coreutils