1*********************************************************
2Setup Toolchain for Mac OS from Scratch (Legacy GNU Make)
3*********************************************************
4:link_to_translation:`zh_CN:[中文]`
5
6.. include:: ../gnu-make-legacy.rst
7
8.. note::
9
10    Standard process for installing the toolchain is described :doc:`here <macos-setup>`. See :ref:`Customized Setup of Toolchain <get-started-customized-setup-legacy>` section for some of the reasons why installing the toolchain from scratch may be necessary.
11
12Install Prerequisites
13=====================
14
15- install pip::
16
17    sudo easy_install pip
18
19.. note::
20
21    ``pip`` will be used later for installing :ref:`the required Python packages <get-started-get-packages-legacy>`.
22
23Compile the Toolchain from Source
24=================================
25
26- Install dependencies:
27
28  - Install either MacPorts_ or homebrew_ package manager. MacPorts needs a full XCode installation, while homebrew only needs XCode command line tools.
29
30    .. _homebrew: https://brew.sh/
31    .. _MacPorts: https://www.macports.org/install.php
32
33  - with MacPorts::
34
35        sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake
36
37  - with homebrew::
38
39        brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake
40
41Create a case-sensitive filesystem image::
42
43    hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
44
45Mount it::
46
47    hdiutil mount ~/esp/crosstool.dmg
48
49Create a symlink to your work directory::
50
51    mkdir -p ~/esp
52    ln -s /Volumes/ctng ~/esp/ctng-volume
53
54Go into the newly created directory::
55
56    cd ~/esp/ctng-volume
57
58Download ``crosstool-NG`` and build it:
59
60.. include-build-file:: inc/scratch-build-code.inc
61
62Build the toolchain::
63
64    ./ct-ng xtensa-esp32-elf
65    ./ct-ng build
66    chmod -R u+w builds/xtensa-esp32-elf
67
68Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-esp32-elf``. Follow :ref:`instructions for standard setup <setup-macos-toolchain-add-it-to-path-legacy>` to add the toolchain to your ``PATH``.
69
70
71Next Steps
72==========
73
74To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf-legacy`.
75