[GUIDE][HOW To Build CyanogenMod on OSX Yosemite]

Discussion in 'Android Hacks and Help' started by rhcp011235, Nov 1, 2014.

  1. rhcp011235

    rhcp011235 Developer
    Developer

    Joined:
    Nov 22, 2013
    Messages:
    164
    Likes Received:
    20
    Trophy Points:
    18
    Ratings:
    +21
    Well,

    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
    **/
    
    Here I am back again, to show you how to build AOSP or CM on your Yosemite build. This can be a hack or a real mac :)

    What You Will Be Installing:

    • Xcode 5
    • Android SDK
    • repo
    • Homebrew
    • many other package

    Xcode 5.1.1
    Sign in with your Apple ID - Apple Developer

    If you have more then one installed. Please just select keep both. You will rename the 5.1.1 version to Xcode-2 in your Applications folder.

    Java
    Java for OS X 2014-001


    Android SDK
    Android SDK Android Developers

    • 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


    Step 1) Make sure you have installed home-brew correctly or remove it. (Personally id say remove it all and do as I say)

    Homebrew



    Code:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/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
    brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt
    
    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
    Quote:
    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 "CM" -attach ~/Desktop/CM
    
    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:
     
    nano ~/.bash_profile
    [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
    export USE_CCACHE=1
    Save it by pressing Ctrl + X , then Ctrl + Y
    
    Once back at the command line in Terminal, enter the following:
    Code:
     
    source ~/.bash_profile
    
    This is the tricky park now. Since we are on Yosemite, You have java 1.8 and two Xcode's installed.

    you will want to add this to your ~/.bash_profile
    Code:
    function setjdk() {
    
      if [ $# -ne 0 ]; then
    
      removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
    
      if [ -n "${JAVA_HOME+x}" ]; then
    
        removeFromPath $JAVA_HOME
    
      fi
    
      export JAVA_HOME=`/usr/libexec/java_home -v $@`
    
      export PATH=$JAVA_HOME/bin:$PATH
    
      fi
    
     }
    
     function removeFromPath() {
    
      export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
    
     }
    
    once that is saved. Close the term and re-open it. this will allow us to change SDK within one term only :)
    big thanks to RomanBB for this idea.

    now for x-code
    Code:
    sudo xcode-select --switch "/Applications/Xcode-2.app/Contents/Developer"
    
    this will set it to the Xcode 5.1.1 we installed



    Now once you ready to build.

    Go to /Volumes/CM
    setjdk 1.6
    sudo xcode-select --switch "/Applications/Xcode-2.app/Contents/Developer"
    and follow the normal build setup and you shall have a working build env for Yosemite
     
    • Like Like x 1
    • Useful Useful x 1
  2. rhcp011235

    rhcp011235 Developer
    Developer

    Joined:
    Nov 22, 2013
    Messages:
    164
    Likes Received:
    20
    Trophy Points:
    18
    Ratings:
    +21
    Android Lollipop Build system for both CM and AOSP

    I was going to post a new guide for this but its quite simple and figured id just add it here.

    In 5.X - You need to be using JDK 1.7 - So you will need to download this:

    Java SE Development Kit 7 - Downloads Oracle Technology Network Oracle

    once you install this. You simply have to do
    rhcps-Mac-Pro:flounder rhcp$ setjdk 1.7

    and now you can build android lollipop :) Simple as that.
     
    #2 rhcp011235, Nov 1, 2014
    Last edited: Dec 14, 2014
    • Like Like x 1
  3. Jeffrey

    Jeffrey Premium Member
    Premium Member

    Joined:
    Jan 30, 2012
    Messages:
    6,686
    Likes Received:
    3,548
    Trophy Points:
    1,578
    Location:
    Thailand
    Ratings:
    +4,036
    Current Phone Model:
    iPhone 7 Plus JB
    Very cool, but much too complicated for me.. How about a 1 click....lol
     
    • Like Like x 1
  4. rhcp011235

    rhcp011235 Developer
    Developer

    Joined:
    Nov 22, 2013
    Messages:
    164
    Likes Received:
    20
    Trophy Points:
    18
    Ratings:
    +21
    Heh. No one clicks. Follow the guide and it's not too hard
     
    • Like Like x 1
  5. Jeffrey

    Jeffrey Premium Member
    Premium Member

    Joined:
    Jan 30, 2012
    Messages:
    6,686
    Likes Received:
    3,548
    Trophy Points:
    1,578
    Location:
    Thailand
    Ratings:
    +4,036
    Current Phone Model:
    iPhone 7 Plus JB
    Comon... you can do it....
     
    • Like Like x 1
  6. rhcp011235

    rhcp011235 Developer
    Developer

    Joined:
    Nov 22, 2013
    Messages:
    164
    Likes Received:
    20
    Trophy Points:
    18
    Ratings:
    +21
    Mods: Sticky this please
     
  7. FoxKat

    FoxKat Premium Member
    Premium Member

    Joined:
    Apr 2, 2010
    Messages:
    14,806
    Likes Received:
    4,751
    Trophy Points:
    838
    Location:
    Pennsylvania
    Ratings:
    +5,290
    Current Phone Model:
    Droid Turbo 2 & Galaxy S7
    Stickied.
     
    • Like Like x 2
    • Informative Informative x 1
  8. cr6

    cr6 Super Moderator
    Staff Member

    Joined:
    Apr 1, 2011
    Messages:
    8,371
    Likes Received:
    5,883
    Trophy Points:
    1,778
    Location:
    NW Rocky Mtn region
    Ratings:
    +6,714
    Current Phone Model:
    Galaxy S7 Edge
    Twitter:
    @dronewolfmedia
    I would like to add that DroidForums is not responsible for anything that may come of this method not working on your device. Please proceed at your own risk and follow all directions as noted.
    Good luck!

    S5 tap'n
     
    • Like Like x 4
  9. Ollie

    Ollie Droid Does

    Joined:
    Apr 13, 2012
    Messages:
    3,442
    Likes Received:
    2,103
    Trophy Points:
    1,468
    Location:
    South Coast
    Ratings:
    +2,483
    Current Phone Model:
    Note Edge - iPhone 6 Plus
    -size 60g -volname "CM" -attach ~/Desktop/CM

    Cannot be smaller than 25g, correct?

    Edit: I think the lowest is 30g.
     
  10. rhcp011235

    rhcp011235 Developer
    Developer

    Joined:
    Nov 22, 2013
    Messages:
    164
    Likes Received:
    20
    Trophy Points:
    18
    Ratings:
    +21
    I honestly never cared about size because all my disks are 1tb ssd. But let us know what works and doesn't ;)
     
  11. Ollie

    Ollie Droid Does

    Joined:
    Apr 13, 2012
    Messages:
    3,442
    Likes Received:
    2,103
    Trophy Points:
    1,468
    Location:
    South Coast
    Ratings:
    +2,483
    Current Phone Model:
    Note Edge - iPhone 6 Plus
    25g is the minimum to complete the build.
     
    • Like Like x 1
  12. GSUS969

    GSUS969 New Member

    Joined:
    Nov 7, 2014
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    1
    Ratings:
    +1
Search tags for this page

android build yosemite brew

,
build android yosemite
,
build cm from source
,
build cm11 from source
,
building android on yosemite
,
cyanogenmod yosemite
,
how to build cyanogenmod 12
,
how to build cyanogenmod rom
,
how to compile cyanogenmod 13 from source
,

yosemite android build