macos-setup.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. **********************************************
  2. Standard Setup of Toolchain for Mac OS (CMake)
  3. **********************************************
  4. :link_to_translation:`zh_CN:[中文]`
  5. .. include:: ../cmake-warning.rst
  6. Install Prerequisites
  7. =====================
  8. ESP-IDF will use the version of Python installed by default on Mac OS.
  9. - install pip::
  10. sudo easy_install pip
  11. - install pyserial::
  12. pip install --user pyserial
  13. - install CMake & Ninja build:
  14. - If you have HomeBrew_, you can run::
  15. brew install cmake ninja
  16. - If you have MacPorts_, you can run::
  17. sudo port install cmake ninja
  18. - Otherwise, consult the CMake_ and Ninja_ home pages for Mac OS installation downloads.
  19. - It is strongly recommended to also install ccache_ for faster builds. If you have HomeBrew_, this can be done via ``brew install ccache`` or ``sudo port install ccache`` on MacPorts_.
  20. .. note::
  21. If an error like this is shown during any step::
  22. xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  23. Then you will need to install the XCode command line tools to continue. You can install these by running ``xcode-select --install``.
  24. Toolchain Setup
  25. ===============
  26. .. include:: /_build/inc/download-links.inc
  27. ESP32 toolchain for macOS is available for download from Espressif website:
  28. |download_link_osx|
  29. Download this file, then extract it in ``~/esp`` directory:
  30. .. include:: /_build/inc/unpack-code-osx.inc
  31. .. _setup-macos-toolchain-add-it-to-path-cmake:
  32. The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory.
  33. To use it, you will need to update your ``PATH`` environment variable in ``~/.profile`` file. To make ``xtensa-esp32-elf`` available for all terminal sessions, add the following line to your ``~/.profile`` file::
  34. export PATH=$HOME/esp/xtensa-esp32-elf/bin:$PATH
  35. Alternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. To do this, add different line to your ``~/.profile`` file::
  36. alias get_esp32="export PATH=$HOME/esp/xtensa-esp32-elf/bin:$PATH"
  37. Then when you need the toolchain you can type ``get_esp32`` on the command line and the toolchain will be added to your ``PATH``.
  38. Log off and log in back to make the ``.profile`` changes effective. Run the following command to verify if ``PATH`` is correctly set::
  39. printenv PATH
  40. Next Steps
  41. ==========
  42. To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf-cmake`.
  43. Related Documents
  44. =================
  45. .. toctree::
  46. :maxdepth: 1
  47. macos-setup-scratch
  48. .. _cmake: https://cmake.org/
  49. .. _ninja: https://ninja-build.org/
  50. .. _ccache: https://ccache.samba.org/
  51. .. _homebrew: https://brew.sh/
  52. .. _MacPorts: https://www.macports.org/install.php