[GUIDE] Setting Up A Build Environment on OS X 10.9 Mavericks

Search This thread

Gandalf

Inactive Recognized Developer / Retired Forum Mode
Mar 29, 2011
3,537
6,668
Philadelphia

Hello everyone,

I've come across, and been asked, a lot of questions regarding how to properly setup a build environment on OS X, so I'm going to make this guide on how to setup a build environment on OS X 10.9 Mavericks.

this is only for setting up the build environment, and since most ROMs use different configurations, you will need to refer to your specific ROM for how to initialize their source and build

MavericksIconX.png


Setting Up an Android Build Environment on OS X 10.9 Mavericks


A Word To The Wise
Code:
/**
 * if you don't follow my instructions exactly as they are written, several things will happen:
 * 1 - If you don't know what you're doing, it won't work
 * 2 - I won't respond with help, since everything you need IS RIGHT HERE 
 **/



What You Will Be Installing:
  • XCode 5
  • Android SDK (includes ADB and Fastboot)
  • repo
  • Homebrew
  • Many, many packages required for building Android



XCode
XCode is roughly a 4 GB download from the AppStore. Once it is downloaded, it will start an installation process, where it will download more software and install XCode on your system. Depending on your hardware, and your internet speeds, this could take a long time.

Apple XCode 5 for OS X 10.9 Mavericks

Or just search for "XCode" in the App Store

Once XCode is downloaded and installed, you can pretty much forget about it. Just don't uninstall it.



Java



Android SDK

  • Extract the contents of the Android SDK download archive to a new folder and name it android-sdk
  • Create a new folder in your HOME directory ( ~/ ) named android [your home directory can be found by opening Finder, and clicking on your username in the column to the left]
  • Move the android-sdk folder INTO the android folder you just made in your Home directory ( it will be ~/android/android-sdk )
  • Using Finder, navigate to the android/android-sdk/tools folder.
  • Double-click the "android" file and go through the installer for Android SDK



Homebrew
Code:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

This will begin the download and installation of Brew.

Depending on your hardware and internet connection, this could take a bit.

Now, 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

After running brew doctor, you should receive a message saying the follow: Your system is ready to brew.

Now, we can install the packages required to build Android.



Required Packages For Compiling Android
Enter the following command into the Terminal:
Code:
brew install git coreutils findutils gnu-sed gnupg pngcrush python

This WILL take a while.



Repo
Open Terminal and enter the following:
Code:
mkdir -p ~/.bin

curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

chmod a+x ~/bin/repo



Creating A Case-Sensitive Volume
We need to create a CASE-SENSITIVE image for our development. Android cannot be build on case-insensitive images, so we need to make one.

Enter the following into the Terminal.
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android

I have it set to be 60 GB here, but you can increase or decrease the size to whatever you choose, simply change the "60" to any number of GB you want it to be. I generally use 100 GB.

Once the command is done, you will see a new .img on your desktop, called android.sparseimage. This is the volume you just created that will store your source. To mount it, you just simply double-click it.



Setting Up bash_profile
Enter the following into Terminal:
Code:
~/.bash_profile

Now copy / paste this into the terminal, so it's in the bash_profile you're creating:
Code:
export PATH=~/bin:$PATH
export PATH=~/android/android-sdk/sdk/platform-tools:$PATH
export PATH=/usr/local/bin:$PATH
export BUILD_MAC_SDK_EXPERIMENTAL=1
export LC_CTYPE=C 
export LANG=C

Save it by pressing Ctrl + X , then Ctrl + Y

Once back at the command line in Terminal, enter the following:
Code:
source ~/.bash_profile

Necessary cherry-picks for OS X compatibility
Here is a list of commits, organized alphabetically by repository, that you will need to cherry-pick in order to ensure the best compatibility for building on OS X:

If you come across other commits related to building on OS X that I have not listed, PLEASE respond to the thread and mention me. I'll get them added!

build
https://github.com/CyanogenMod/android_build/commit/e04d4ddad4790a5f67d96873890cdc8230f0e18a

openssl / sha1sum errors?
https://github.com/CyanogenMod/android_build/commit/18c1d6d96df97b975b87a2736446c9dfd3ab4169

readink -f errors?
https://github.com/omnirom/android_build/commit/27e819cd6b6c44cbb86a0dc2bd3d735ad5dc09e7

sed/gsed errors that is NOT "sed: RE error: illegal byte sequence"?
https://github.com/omnirom/android_build/commit/24b9c1bfe07d24f7e2a425d9d5aae52fd30f3819

errors with the zip creation?
https://github.com/omnirom/android_build/commit/08c61654feff40eeec04eef40f4970408de1e229

JNI errors in /external/chromium_org ?
external_chromium_org
https://github.com/CyanogenMod/andr...mmit/5130af630390487b37d99941887883647c67f37a
That's it. Refer to your individual ROM source for how to sync the manifests and get builds going. Happy building!
 
Last edited:

nazforex

Senior Member
Oct 14, 2009
612
88
I get the following error everytime:

Code:
Creating filesystem with parameters:
    Size: 13725835264
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8144
    Inode size: 256
    Journal blocks: 32768
    Label: 
    Blocks: 3351034
    Block groups: 103
    Reserved block group size: 823
Created filesystem with 11/838832 inodes and 93654/3351034 blocks
+ '[' 0 -ne 0 ']'
stat: cannot read file system information for `%z': No such file or directory
/bin/bash: File: "/Volumes/android/omni/out/target/product/hammerhead/userdata.img"
    ID: 100000600000011 Namelen: *       Type: hfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 39237622   Free: 18393164   Available: 18393164
Inodes: Total: 39237620   Free: 18393164
+
0 : syntax error in expression (error token is ": "/Volumes/android/omni/out/target/product/hammerhead/userdata.img"
    ID: 100000600000011 Namelen: *       Type: hfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 39237622   Free: 18393164   Available: 18393164
Inodes: Total: 39237620   Free: 18393164
+
0 ")
make: *** [/Volumes/android/omni/out/target/product/hammerhead/userdata.img] Error 1
make: *** Deleting file `/Volumes/android/omni/out/target/product/hammerhead/userdata.img'
make: *** Waiting for unfinished jobs....

real	8m50.579s
user	1m9.360s
sys	0m46.059s

I get this building Omni but I don't get it building CM11
Any idea?
 
Last edited:

Gandalf

Inactive Recognized Developer / Retired Forum Mode
Mar 29, 2011
3,537
6,668
Philadelphia
  • Like
Reactions: InF1uxx and fzr-r4

joneidy

Member
Feb 8, 2011
44
18
repo should be installed with brew, no need to download the binary from google :good: although, i may be wrong

Hello everyone, I`m getting the following error when trying to build Kitkat. If any help is given it will be greatly appreciated.

Code:
ldldld:::   warning:warning warning: directory:directory   notdirectory  notfoundnot   foundforfound   foroptionfor   'option-option Lout '/'-host-LoutLout///darwinhost-host/x86/darwin/darwin--objx86x86///libobjobj/'/lib
lib'ld'
:
ld ld:warning::   warningwarning:option:   -options option-  is-s  sobsoleteis   obsoleteandis   andbeing obsoletebeing   ignoredandignored
 
ldbeingld:  :ignoredunknown 
 unknownoptionld :option :-:  O2-unknown
O2 
option: -O2
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/validatekeymaps_intermediates/validatekeymaps] Error 1
make: *** Waiting for unfinished jobs....
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1
make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl] Error 1
 

fzr-r4

Senior Member
Sep 7, 2010
434
75
Berkeley
case-sensitive output directory/volume

building Paranoid Android using the team's script for the build itself after syncing, I had to specify the output directory first, out I got an error saying I was building on a case-insensitive system:

export OUT_DIR_COMMON_BASE=YOUR-VOLUME-AND-DESTINATION-HERE


Sent from my Nexus 5 using Tapatalk 4
 

joneidy

Member
Feb 8, 2011
44
18
Another Build Error

Now I`m getting the following error, does anyone knows if I can just manually create the missing directory to skip the error?
Thanks in advance.

Code:
host C: libbz <= external/bzip2/bzlib.c
Import includes file: out/host/darwin-x86/obj/EXECUTABLES/bsdiff_intermediates/import_includes
host C++: validatekeymaps <= frameworks/base/tools/validatekeymaps/Main.cpp
host StaticLib: libinput (out/host/darwin-x86/obj/STATIC_LIBRARIES/libinput_intermediates/libinput.a)
host StaticLib: libutils (out/host/darwin-x86/obj/STATIC_LIBRARIES/libutils_intermediates/libutils.a)
host StaticLib: libcutils (out/host/darwin-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a)
host C: acp <= build/tools/acp/acp.c
host StaticLib: liblog (out/host/darwin-x86/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a)
host Executable: aidl (out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl)
host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
host C++: aapt <= frameworks/base/tools/aapt/Command.cpp
host C++: aapt <= frameworks/base/tools/aapt/CrunchCache.cpp
host C++: aapt <= frameworks/base/tools/aapt/FileFinder.cpp
host C++: aapt <= frameworks/base/tools/aapt/Main.cpp
host C++: aapt <= frameworks/base/tools/aapt/Package.cpp
host C++: aapt <= frameworks/base/tools/aapt/StringPool.cpp
ld: warning: directory not found for option '-Lout/host/darwin-x86/obj/lib'
ld: warning: option -s is obsolete and being ignored
ld: unknown option: -O2
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl] Error 1
make: *** Waiting for unfinished jobs....
 

fzr-r4

Senior Member
Sep 7, 2010
434
75
Berkeley
sigh . . . Paranoid Android 4 completes a build for me on Mavericks, but root and wi-fi are broken. Terminal and Solid Explorer also don't work. :crying::confused:

just putting this out there as a data point in case others try building PA on OS X.

EDIT:

i noticed that Symlink lines such as:

Symlink: /volumes/teamusb/output/android/target/product/hammerhead/system/xbin/rdev -> busybox

or

Symlink: /volumes/teamusb/output/android/target/product/hammerhead/system/bin/du -> toolbox

are resulting in those files (/system/xbin/rdev or /system/bin/du) being created in my .zip file, whereas a successful build from another user does not have those files.

this seems to be part of my problem--anyone have any guidance or similar issues?
 
Last edited:

JoshX

Senior Member
Jun 17, 2011
50
72
San Francisco
I get the following error everytime:

Code:
Creating filesystem with parameters:
    Size: 13725835264
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8144
    Inode size: 256
    Journal blocks: 32768
    Label: 
    Blocks: 3351034
    Block groups: 103
    Reserved block group size: 823
Created filesystem with 11/838832 inodes and 93654/3351034 blocks
+ '[' 0 -ne 0 ']'
stat: cannot read file system information for `%z': No such file or directory
/bin/bash: File: "/Volumes/android/omni/out/target/product/hammerhead/userdata.img"
    ID: 100000600000011 Namelen: *       Type: hfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 39237622   Free: 18393164   Available: 18393164
Inodes: Total: 39237620   Free: 18393164
+
0 : syntax error in expression (error token is ": "/Volumes/android/omni/out/target/product/hammerhead/userdata.img"
    ID: 100000600000011 Namelen: *       Type: hfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 39237622   Free: 18393164   Available: 18393164
Inodes: Total: 39237620   Free: 18393164
+
0 ")
make: *** [/Volumes/android/omni/out/target/product/hammerhead/userdata.img] Error 1
make: *** Deleting file `/Volumes/android/omni/out/target/product/hammerhead/userdata.img'
make: *** Waiting for unfinished jobs....

real	8m50.579s
user	1m9.360s
sys	0m46.059s

I get this building Omni but I don't get it building CM11
Any idea?

CM11 uses gstat, where Omni is using stat. I had to troubleshoot this too. in "build/core/combo/HOST_darwin-x86.mk" the last line should be
Code:
# $(1): The file to check
define get-file-size
GSTAT=$(which gstat) ; \
if [ ! -z "$GSTAT" ]; then \
gstat -c "%s" $(1) ; \
else \
stat -f "%z" $(1) ; \
fi
endef

That should fix the compile error for the userdata.img
 

MikeC84

Senior Member
Jun 21, 2010
1,513
836
Tucson
Got a question. Is brew needed for just building kernels? I usually use ubuntu for my builds but I would like to use osx if I could as well.
 

Gandalf

Inactive Recognized Developer / Retired Forum Mode
Mar 29, 2011
3,537
6,668
Philadelphia
Got a question. Is brew needed for just building kernels? I usually use ubuntu for my builds but I would like to use osx if I could as well.

I believe so. Brew is basically a tool that allows Linux CLI commands to be run on OS X, so you wouldn't be able to execute the necessary tools for building anything, but I'm not 100% sure.

this i s awesome! thanks for the guide. kinda tired of using a virtual machine to build android :p

Yea, using VM's kind of sucks because you are unable to utilize the full power of your hardware

Thanks boys i am triying it on snow leopard with omnirom

should be relatively the same with some very minor changes, I built on Snow Leopard using these directions, you will definitely NOT need to worry about switch.pm stuff with snow leopard.

sigh . . . Paranoid Android 4 completes a build for me on Mavericks, but root and wi-fi are broken. Terminal and Solid Explorer also don't work. :crying::confused:

just putting this out there as a data point in case others try building PA on OS X.

EDIT:

i noticed that Symlink lines such as:

Symlink: /volumes/teamusb/output/android/target/product/hammerhead/system/xbin/rdev -> busybox

or

Symlink: /volumes/teamusb/output/android/target/product/hammerhead/system/bin/du -> toolbox

are resulting in those files (/system/xbin/rdev or /system/bin/du) being created in my .zip file, whereas a successful build from another user does not have those files.

this seems to be part of my problem--anyone have any guidance or similar issues?

I've had issues building OmniROM with stuff like this as well, and was never able to/didn't put much effort into finding the source. If you know what the cause of these device functions is please PM me the solution and I will make sure to update the OP with a quote from you :highfive:

Now I`m getting the following error, does anyone knows if I can just manually create the missing directory to skip the error?
Thanks in advance.

Code:
host C: libbz <= external/bzip2/bzlib.c
Import includes file: out/host/darwin-x86/obj/EXECUTABLES/bsdiff_intermediates/import_includes
host C++: validatekeymaps <= frameworks/base/tools/validatekeymaps/Main.cpp
host StaticLib: libinput (out/host/darwin-x86/obj/STATIC_LIBRARIES/libinput_intermediates/libinput.a)
host StaticLib: libutils (out/host/darwin-x86/obj/STATIC_LIBRARIES/libutils_intermediates/libutils.a)
host StaticLib: libcutils (out/host/darwin-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a)
host C: acp <= build/tools/acp/acp.c
host StaticLib: liblog (out/host/darwin-x86/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a)
host Executable: aidl (out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl)
host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
host C++: aapt <= frameworks/base/tools/aapt/Command.cpp
host C++: aapt <= frameworks/base/tools/aapt/CrunchCache.cpp
host C++: aapt <= frameworks/base/tools/aapt/FileFinder.cpp
host C++: aapt <= frameworks/base/tools/aapt/Main.cpp
host C++: aapt <= frameworks/base/tools/aapt/Package.cpp
host C++: aapt <= frameworks/base/tools/aapt/StringPool.cpp
ld: warning: directory not found for option '-Lout/host/darwin-x86/obj/lib'
ld: warning: option -s is obsolete and being ignored
ld: unknown option: -O2
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl] Error 1
make: *** Waiting for unfinished jobs....

Hello everyone, I`m getting the following error when trying to build Kitkat. If any help is given it will be greatly appreciated.

Code:
ldldld:::   warning:warning warning: directory:directory   notdirectory  notfoundnot   foundforfound   foroptionfor   'option-option Lout '/'-host-LoutLout///darwinhost-host/x86/darwin/darwin--objx86x86///libobjobj/'/lib
lib'ld'
:
ld ld:warning::   warningwarning:option:   -options option-  is-s  sobsoleteis   obsoleteandis   andbeing obsoletebeing   ignoredandignored
 
ldbeingld:  :ignoredunknown 
 unknownoptionld :option :-:  O2-unknown
O2 
option: -O2
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/validatekeymaps_intermediates/validatekeymaps] Error 1
make: *** Waiting for unfinished jobs....
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1
make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl] Error 1

Looks like your missing ld to me? try brew install ld, if that doesn't work, just google "how to install ld with brew" :highfive:
 
  • Like
Reactions: joneidy

baalho

Member
Oct 13, 2009
39
6
Indy
Thank you for this awesome guide. I have one question.
I have the latest Java installed, should I uninstall it before I follow this guide?

Sent from my Evo 3D CDMA using Tapatalk
 

MikeC84

Senior Member
Jun 21, 2010
1,513
836
Tucson
I believe so. Brew is basically a tool that allows Linux CLI commands to be run on OS X, so you wouldn't be able to execute the necessary tools for building anything, but I'm not 100% sure.

Thanks. After running brew doctor I am not getting "ready to brew"

Code:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libosxfuse_i32.2.dylib
    /usr/local/lib/libosxfuse_i64.2.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libosxfuse_i32.la
    /usr/local/lib/libosxfuse_i64.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/osxfuse.pc
 

Gandalf

Inactive Recognized Developer / Retired Forum Mode
Mar 29, 2011
3,537
6,668
Philadelphia
Thanks. After running brew doctor I am not getting "ready to brew"

Code:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libosxfuse_i32.2.dylib
    /usr/local/lib/libosxfuse_i64.2.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libosxfuse_i32.la
    /usr/local/lib/libosxfuse_i64.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/osxfuse.pc

i never personally got that error, but it looks like you should be able to just delete the files listed here. Just make sure you have ALL of your stuff backed up before doing anything in the OS X system files. I'm not 100% though, so worse you can do is try it and see
 

dfrias

Member
Jun 22, 2010
18
1
Need Help

Nevermind, figured it out, it was the way i was typing the command, re-entered it as:

nano -w ~/.bash_profile

and it took me to the correct location.

Hello Everyone, I am completely new to this and was wondering if any of you could help me with a question:

When i try to add the new text to the .bash_profile file i get this error:

[ Error writing /Users/dfrias84/Users/dfrias84/.bash_profile: No such file or ]

Why is this error popping up?

I noticed every time i type the code into terminal (nano -w ~/Users/dfrias84/.bash_profile) it opens nano with this:

GNU nano 2.0.6 File: /Users/dfrias84/Users/dfrias84/.bash_profile

Why is the directory different from what i typed into the command?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 44

    Hello everyone,

    I've come across, and been asked, a lot of questions regarding how to properly setup a build environment on OS X, so I'm going to make this guide on how to setup a build environment on OS X 10.9 Mavericks.

    this is only for setting up the build environment, and since most ROMs use different configurations, you will need to refer to your specific ROM for how to initialize their source and build

    MavericksIconX.png


    Setting Up an Android Build Environment on OS X 10.9 Mavericks


    A Word To The Wise
    Code:
    /**
     * if you don't follow my instructions exactly as they are written, several things will happen:
     * 1 - If you don't know what you're doing, it won't work
     * 2 - I won't respond with help, since everything you need IS RIGHT HERE 
     **/



    What You Will Be Installing:
    • XCode 5
    • Android SDK (includes ADB and Fastboot)
    • repo
    • Homebrew
    • Many, many packages required for building Android



    XCode
    XCode is roughly a 4 GB download from the AppStore. Once it is downloaded, it will start an installation process, where it will download more software and install XCode on your system. Depending on your hardware, and your internet speeds, this could take a long time.

    Apple XCode 5 for OS X 10.9 Mavericks

    Or just search for "XCode" in the App Store

    Once XCode is downloaded and installed, you can pretty much forget about it. Just don't uninstall it.



    Java



    Android SDK

    • Extract the contents of the Android SDK download archive to a new folder and name it android-sdk
    • Create a new folder in your HOME directory ( ~/ ) named android [your home directory can be found by opening Finder, and clicking on your username in the column to the left]
    • Move the android-sdk folder INTO the android folder you just made in your Home directory ( it will be ~/android/android-sdk )
    • Using Finder, navigate to the android/android-sdk/tools folder.
    • Double-click the "android" file and go through the installer for Android SDK



    Homebrew
    Code:
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

    This will begin the download and installation of Brew.

    Depending on your hardware and internet connection, this could take a bit.

    Now, 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

    After running brew doctor, you should receive a message saying the follow: Your system is ready to brew.

    Now, we can install the packages required to build Android.



    Required Packages For Compiling Android
    Enter the following command into the Terminal:
    Code:
    brew install git coreutils findutils gnu-sed gnupg pngcrush python

    This WILL take a while.



    Repo
    Open Terminal and enter the following:
    Code:
    mkdir -p ~/.bin
    
    curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    
    chmod a+x ~/bin/repo



    Creating A Case-Sensitive Volume
    We need to create a CASE-SENSITIVE image for our development. Android cannot be build on case-insensitive images, so we need to make one.

    Enter the following into the Terminal.
    Code:
    hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android

    I have it set to be 60 GB here, but you can increase or decrease the size to whatever you choose, simply change the "60" to any number of GB you want it to be. I generally use 100 GB.

    Once the command is done, you will see a new .img on your desktop, called android.sparseimage. This is the volume you just created that will store your source. To mount it, you just simply double-click it.



    Setting Up bash_profile
    Enter the following into Terminal:
    Code:
    ~/.bash_profile

    Now copy / paste this into the terminal, so it's in the bash_profile you're creating:
    Code:
    export PATH=~/bin:$PATH
    export PATH=~/android/android-sdk/sdk/platform-tools:$PATH
    export PATH=/usr/local/bin:$PATH
    export BUILD_MAC_SDK_EXPERIMENTAL=1
    export LC_CTYPE=C 
    export LANG=C

    Save it by pressing Ctrl + X , then Ctrl + Y

    Once back at the command line in Terminal, enter the following:
    Code:
    source ~/.bash_profile

    Necessary cherry-picks for OS X compatibility
    Here is a list of commits, organized alphabetically by repository, that you will need to cherry-pick in order to ensure the best compatibility for building on OS X:

    If you come across other commits related to building on OS X that I have not listed, PLEASE respond to the thread and mention me. I'll get them added!

    build
    https://github.com/CyanogenMod/android_build/commit/e04d4ddad4790a5f67d96873890cdc8230f0e18a

    openssl / sha1sum errors?
    https://github.com/CyanogenMod/android_build/commit/18c1d6d96df97b975b87a2736446c9dfd3ab4169

    readink -f errors?
    https://github.com/omnirom/android_build/commit/27e819cd6b6c44cbb86a0dc2bd3d735ad5dc09e7

    sed/gsed errors that is NOT "sed: RE error: illegal byte sequence"?
    https://github.com/omnirom/android_build/commit/24b9c1bfe07d24f7e2a425d9d5aae52fd30f3819

    errors with the zip creation?
    https://github.com/omnirom/android_build/commit/08c61654feff40eeec04eef40f4970408de1e229

    JNI errors in /external/chromium_org ?
    external_chromium_org
    https://github.com/CyanogenMod/andr...mmit/5130af630390487b37d99941887883647c67f37a
    That's it. Refer to your individual ROM source for how to sync the manifests and get builds going. Happy building!
    2
    for others using this awesome guide, don't forget to install repo in terminal the following commands before initializing repo

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

    repo should be installed with brew, no need to download the binary from google :good: although, i may be wrong
    2
    I haven't had an Apple product in almost a year and a half - two years now. Long enough to where I can't remember when I got rid of my Macbook Pro. If someone wants the OP updated for new version of OS X just ping me here and I can update it :highfive:
    1
    This is amazing. Thank you so much!
    1
    Congrats @jakew02 Your outstanding guide made it to the Portal!

    Check out the article HERE.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone