macos-setup-scratch.rst 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ***********************************************
  2. Setup Toolchain for Mac OS from Scratch
  3. ***********************************************
  4. :link_to_translation:`zh_CN:[中文]`
  5. Package Manager
  6. ===============
  7. To set up the toolchain from scratch, rather than :doc:`downloading a pre-compiled toolchain<macos-setup>`, you will need to install either the MacPorts_ or Homebrew_ package manager.
  8. MacPorts needs a full XCode installation, while Homebrew only needs XCode command line tools.
  9. .. _Homebrew: https://brew.sh/
  10. .. _MacPorts: https://www.macports.org/install.php
  11. See :ref:`Customized Setup of Toolchain <get-started-customized-setup>` section for some of the reasons why installing the toolchain from scratch may be necessary.
  12. Install Prerequisites
  13. =====================
  14. - install pip::
  15. sudo easy_install pip
  16. - install pyserial::
  17. pip install --user pyserial
  18. - install CMake & Ninja build:
  19. - If you have Homebrew, you can run::
  20. brew install cmake ninja dfu-util
  21. - If you have MacPorts, you can run::
  22. sudo port install cmake ninja dfu-util
  23. Compile the Toolchain from Source
  24. =================================
  25. Install dependencies:
  26. - with MacPorts::
  27. sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake make
  28. - with Homebrew::
  29. brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake make
  30. Create a case-sensitive filesystem image::
  31. hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
  32. Mount it::
  33. hdiutil mount ~/esp/crosstool.dmg
  34. Create a symlink to your work directory::
  35. mkdir -p ~/esp
  36. ln -s /Volumes/ctng ~/esp/ctng-volume
  37. Go into the newly created directory::
  38. cd ~/esp/ctng-volume
  39. Download ``crosstool-NG`` and build it:
  40. .. include-build-file:: inc/scratch-build-code.inc
  41. Build the toolchain::
  42. ./ct-ng {IDF_TARGET_TOOLCHAIN_PREFIX}
  43. ./ct-ng build
  44. chmod -R u+w builds/{IDF_TARGET_TOOLCHAIN_PREFIX}
  45. Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}``. To use it, you need to add ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin`` to ``PATH`` environment variable.
  46. Next Steps
  47. ==========
  48. To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.