# ESP32: problem with compilation on MacOS 12.3 Monterey

**URL:** <https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771>\
**Category:** IDE 1.x\
**Created:** [March 16, 2022, 2:08am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771 "2022-03-16T02:08:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 2:08am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/1 "2022-03-16T02:08:23Z")

</div>

Hi there, since Apple upgraded MacOS Monterey to 12.3 Arduino is not able to find python - apparently there is no more python 2.7 in MacOS. But installing python 3 and making sure it is in $PATH does not help much - still the problem is: Arduino - or as I was told on Arduino Gighub page - ESP32 part of it, is looking for python and not finding it.  
Workaround is to run Arduino directly from terminal rather than GUI - then, there is no problem. But that seems dirty trick and probably could be avoided if ESP32 board manager would behave better. Do you know any solution for that please?  
This problem is for both: Arduino 1.8.19/20 and 2.x

Problem starts here:

```cpp
Merged 25 ELF sections
python /Users/me/Library/Arduino15/packages/esp32/hardware/esp32/2.0.2/tools/gen_esp32part.py -q /var/folders/l2/q1yr15k169z43pw_hczk1ckw0000gn/T/arduino_build_890727/partitions.csv /var/folders/l2/q1yr15k169z43pw_hczk1ckw0000gn/T/arduino_build_890727/82-esp32s-test.ino.partitions.bin
...
exec: "python": executable file not found in $PATH
Error compiling for board ESP32 Dev Module.

```

Of course .zprofile has the path to python.:

```cpp
papio@MBP16M1papio ~ % echo $PATH

/opt/homebrew/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Little Snitch.app/Contents/Components

papio@MBP16M1papio ~ % which python

/opt/homebrew/bin/python

papio@MBP16M1papio ~ %

```

when using such command in terminal all is ok:  
`papio@MBP16M1papio ~ % open /Applications/Arduino.app`

Any suggestion please?  
thank you

---

<div class="post-metadata">

**Author:** ![JustSomeHuman](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/justsomehuman/32/1126423_2.png) [@JustSomeHuman](https://forum.arduino.cc/u/JustSomeHuman)\
**Post date:** [March 16, 2022, 4:18am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/2 "2022-03-16T04:18:01Z")

</div>

Yes, I am having the same problem with Monterey 12.3. I have python 3.8 installed with homebrew. I think the problem is that the links now point to python3. On my system, this is what I see.

ershler@Philips-MacBook-Pro ~ % which python  
python not found

ershler@Philips-MacBook-Pro ~ % which python3  
/opt/homebrew/opt/python@3.8/bin/python3

ershler@Philips-MacBook-Pro ~ % python3  
Python 3.8.12 (default, Oct 22 2021, 17:47:41)  
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin  
Type "help", "copyright", "credits" or "license" for more information.

> > >

So it's not clear to me how to tell Arduino to use python3.

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 4:29am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/3 "2022-03-16T04:29:53Z")

</div>

but I linked python to python3 - it does not help  
but when started from terminal it works

btw for whatever reason Arduino 2.x WORKS when started from GUI (after creating the link)  
but Arduino 1.8.x does NOT work from GUI

---

<div class="post-metadata">

**Author:** ![bernard\_ulrich](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@bernard\_ulrich](https://forum.arduino.cc/u/bernard_ulrich)\
**Post date:** [March 16, 2022, 10:33am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/4 "2022-03-16T10:33:54Z")

</div>

Hi, got exactly the same problem, unable to re-compile sketches that worked previously... I started Arduino.app from terminal and no more success. How did you start ? Just papio@MBP16M1papio ~ % open /Applications/Arduino.app. ? I put my Arduino.app on desktop not in Application folder..

Thanks

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 11:15am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/5 "2022-03-16T11:15:19Z")

</div>

open terminal and type:  
`open /Applications/Arduino.app`

---

<div class="post-metadata">

**Author:** ![bernard\_ulrich](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@bernard\_ulrich](https://forum.arduino.cc/u/bernard_ulrich)\
**Post date:** [March 16, 2022, 11:56am UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/6 "2022-03-16T11:56:32Z")

</div>

Yes, but as my Arduino.app remains in /Users/bernardulrich/Downloads.

I start it from there. and I can't find python in my system.  
Thus even starting Arduino from Terminal doesn't solve problem.  
Any additional advice ? Many Thanks

---

<div class="post-metadata">

**Author:** ![nadym](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nadym/32/1098826_2.png) [@nadym](https://forum.arduino.cc/u/nadym)\
**Post date:** [March 16, 2022, 12:12pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/7 "2022-03-16T12:12:54Z")

</div>

have the same problem 😭

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 1:08pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/8 "2022-03-16T13:08:13Z")

</div>

enter command:

```cpp
which python

```

if it says nothing (as it should since 12.3 MacOS) then enter command:  
`which python3`  
this one should return the path - if not, first you must install python3  
if it returns the path, link them by using command:  
`sudo ln -s /path/displayed/above /usr/local/bin/python`  
provided /usr/local/bin is in your PATH - check by entering command:  
`echo $PATH`  
I installed python3 by using brew - you can also install xcode (from appstore)

---

<div class="post-metadata">

**Author:** ![dennisgodderie](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dennisgodderie](https://forum.arduino.cc/u/dennisgodderie)\
**Post date:** [March 16, 2022, 1:38pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/9 "2022-03-16T13:38:34Z")

</div>

Same problem here. Tried what you suggested (I installed python3), but doesn't seem to work.

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 2:15pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/10 "2022-03-16T14:15:03Z")

</div>

say what this command shows (in terminal):  
`which python`

---

<div class="post-metadata">

**Author:** ![nadym](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nadym/32/1098826_2.png) [@nadym](https://forum.arduino.cc/u/nadym)\
**Post date:** [March 16, 2022, 2:21pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/11 "2022-03-16T14:21:25Z")

</div>

doesn't show anything for me

`which python3` shows:

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 3:07pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/12 "2022-03-16T15:07:36Z")

</div>

now make this:  
`sudo ln -s /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 /usr/local/bin/python`  
after this command try again with  
`which python`

---

<div class="post-metadata">

**Author:** ![bernard\_ulrich](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@bernard\_ulrich](https://forum.arduino.cc/u/bernard_ulrich)\
**Post date:** [March 16, 2022, 3:08pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/13 "2022-03-16T15:08:23Z")

</div>

This is the status on my MacOS Monterey 13.2. (M1)  
~ % which python  
/usr/local/bin/python

~ % which python3  
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3

~ % echo $PATH  
/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Compilation of existing code that successfully compiled in 2021,  
1.) when starting with GUI gives an error (lack of python)  
2.) and when starting with terminal it gives same error but asks for Command Line Developer Tools install (I tried it several times long minutes... , and being asked again and again after end of compilation, and error).....

---

<div class="post-metadata">

**Author:** ![nadym](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nadym/32/1098826_2.png) [@nadym](https://forum.arduino.cc/u/nadym)\
**Post date:** [March 16, 2022, 3:29pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/14 "2022-03-16T15:29:13Z")

</div>

> [@zyghom](#):
>
> after this command try again with  
> `which python`

unfortunately nothing happens

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 3:53pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/16 "2022-03-16T15:53:32Z")

</div>

so I propose to install brew and once brew is installed, enter command:  
`brew install python`

brew is here:

> **[Homebrew](https://brew.sh)**
>
> The Missing Package Manager for macOS (or Linux).

and to install brew:  
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`

---

<div class="post-metadata">

**Author:** ![bernard\_ulrich](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@bernard\_ulrich](https://forum.arduino.cc/u/bernard_ulrich)\
**Post date:** [March 16, 2022, 4:22pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/17 "2022-03-16T16:22:10Z")

</div>

I performed Homebrew install, and installed Python 3.9.10... (previous trials were done with 3.10 that seems to be fixed in $PATH).  
But always remaining compile error python: error: Failed to locate 'python'.

My setup is  
~ % which python  
/usr/local/bin/python

~ % which python3  
/opt/homebrew/bin/python3

and....echo $PATH  
/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 4:32pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/18 "2022-03-16T16:32:12Z")

</div>

close Arduino completely (Command Q), even reboot macos  
don't start Arduino from GUI  
open terminal  
type:  
`open /Applications/Arduino.app`  
it will start Arduino  
it works for me

---

<div class="post-metadata">

**Author:** ![johnwasser](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnwasser/32/214270_2.png) [@johnwasser](https://forum.arduino.cc/u/johnwasser)\
**Post date:** [March 16, 2022, 4:33pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/19 "2022-03-16T16:33:57Z")

</div>

> **[Python Releases for macOS](https://www.python.org/downloads/macos/)**
>
> The official home of the Python Programming Language

I would install the latest Python 2 AND Python 3 from here.

% which python  
/usr/bin/python

% python -V  
Python 2.7.18

% which python3  
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

% python3 -V  
Python 3.9.2

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 4:35pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/20 "2022-03-16T16:35:37Z")

</div>

true, but the thing is not WRONG python (3 instead of 2) but LACK of python - not visible by the environment variables  
and I opened the ticket with Arduino - they told me: "Arduino does NOT use python but the manager for ESP uses" so ticket was closed today

---

<div class="post-metadata">

**Author:** ![zyghom](https://avatars.discourse-cdn.com/v4/letter/z/9de0a6/32.png) [@zyghom](https://forum.arduino.cc/u/zyghom)\
**Post date:** [March 16, 2022, 4:39pm UTC](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771/21 "2022-03-16T16:39:11Z")

</div>

actually I made a link to/opt/homebrew/bin/python not /usr/local/bin/python but since both paths are in $PATH it should not make a difference

```cpp
papio@MBP16M1papio ~ % ls -la /opt/homebrew/bin/python* | grep -v config
lrwxr-xr-x 1 root admin 25 15 Mar 15:06 /opt/homebrew/bin/python -> /opt/homebrew/bin/python3
lrwxr-xr-x 1 papio admin 39 15 Mar 11:17 /opt/homebrew/bin/python3 -> ../Cellar/python@3.9/3.9.10/bin/python3
lrwxr-xr-x 1 papio admin 41 15 Mar 11:17 /opt/homebrew/bin/python3.9 -> ../Cellar/python@3.9/3.9.10/bin/python3.9

```

[Next page](https://forum.arduino.cc/t/esp32-problem-with-compilation-on-macos-12-3-monterey/969771.md?page=2)
