# MQTT problems with Node-RED on macOS 13.2

**URL:** <https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126>\
**Category:** General\
**Created:** [24 January 2023 14:42 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126 "2023-01-24T14:42:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![duaw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/duaw/32/20970_2.png) [@duaw](https://discourse.nodered.org/u/duaw)\
**Post date:** [24 January 2023 14:42 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/1 "2023-01-24T14:42:43Z")

</div>

Dear all!  
I have an instance of the latest _Node-RED Version: v3.0.2_ with _Node.js Version: v19.4.0_ running on my M1 MacBook Pro with _Darwin 22.3.0 arm64 LE_ just to try out things from time to time. It used to work like a charm.

Now MQTT does not work anymore.

What has happened in between? A lot... Among other things macOS 13.2 has arrived today.

What is happening now:

- I start mosquitto in a shell, it is up and running:  
_mosquitto version 2.0.15 running_
- a Tasmota device connects, MQTT broker reports it:  
_New connection from 192.168.178.27:1557 on port 1883._
- I start a Python script (new shell) connecting my Tinkerforge Hardware to the broker.
- It connects to the broker on the same machine :  
_MQTT bindings: Connected to MQTT broker at localhost:1883_
- MQTT broker reports that:  
_New connection from 127.0.0.1:51208 on port 1883_.
- I START Node-RED in a third shell !!!
- Node-RED logs  
_[mqtt-broker:ea5e37ad8d4835c7] Verbindung zum Broker mqtt://localhost:1883 konnte nicht hergestellt werden_ ... **Connection to ... could not be established**.
- the MQTT in/out nodes in Node-RED are stuck trying to connect (yellow squared box).

Why?

- The MQTT config item in Node-RED is well defined and remained unchanged ...
- I can connect to the MQTT broker from _localhost_ with other tools.

What's wrong here? Any idea?  
Cheers, Uwe

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 January 2023 16:39 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/2 "2023-01-24T16:39:50Z")

</div>

> [@duaw](#):
>
> Verbindung zum Broker mqtt://localhost:1883 konnte nicht hergestellt werden

Since you have stated `172.0.0.1` can connect & Node-RED is failing to connect to `localhost` it suggests a networking issue. Try setting the broker connection in node-red to `172.0.0.1` instead of `localhost`

---

<div class="post-metadata">

**Author:** ![duaw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/duaw/32/20970_2.png) [@duaw](https://discourse.nodered.org/u/duaw)\
**Post date:** [24 January 2023 18:53 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/3 "2023-01-24T18:53:52Z")

</div>

I will do so, but I think this is definitely not a networking issue. Resolving localhost works: my Python script connects successully to "localhost:1883" and the MQTT broker reports the new connection from 127.0.0.1.  
No clue ...

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [24 January 2023 19:13 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/4 "2023-01-24T19:13:17Z")

</div>

I've seen similar issues.  
They were related to the definition of `localhost` - being either IP6 or IP4.  
I'd propose to check your definition within the node.js environment; my bet: it's IP6 (`::`)... whereas all others are defined as IP4.  
The easiest way to solve: Let the node explicitly connect to `mqtt://127.0.0.1:1883`.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [24 January 2023 21:15 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/5 "2023-01-24T21:15:59Z")

</div>

Being a Mac owner myself, I’d suggest getting a pizerow and installing mosquito on it. Then just point the mqtt nodes on your mac at the ip address of the pizerow. That’s how I’ve had my broker running for over two years.

Oh and if you install netatalk on the pi you can access the pi from the finder on the Mac. If you are interested I can send you my write up on what I do to install netatalk on my pi’s and how I configure it.

---

<div class="post-metadata">

**Author:** ![duaw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/duaw/32/20970_2.png) [@duaw](https://discourse.nodered.org/u/duaw)\
**Post date:** [25 January 2023 10:05 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/6 "2023-01-25T10:05:53Z")

</div>

Amazing ... changing localhost to 127.0.0.1 did the trick.  
Looks like the stuff Node-RED relies on works now differently than it used to.  
Concluding "localhost works, so the lower layers of networking work" is not valid.  
Thanks & Cheers, Uwe

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 January 2023 11:38 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/7 "2023-01-25T11:38:42Z")

</div>

Actually it is a change in nodejs that is tripping things up - they now (node18+) prioritise ipv6 DNS lookups over ipv4

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 February 2023 11:39 UTC](https://discourse.nodered.org/t/mqtt-problems-with-node-red-on-macos-13-2/74126/8 "2023-02-08T11:39:16Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
