user31105: I'm using an Arduino Mega which has 4 RX/TX UARTS/serials.
3 RX's of them I use for MIDI In 
2 TX's of them I use for MIDI Out (maybe later a DMX out too)
One I use currently for debugging. On the other hand, in the future I want:

Using an ESP8266 WIFI which also seems to use an UART (both RX/TX)

Of course I can remove the debugging RX/TX, but maybe some more additions are needed and for the first RX/TX I need to remove the RX each time I upload (so I rather leave it for debugging).
I was wondering, is it possible to share an UART if I don't use the WIFI module and MIDI port at the same time?

user313: If your application can tolerate the limitations of SoftwareSerial, it's the easiest way to add a port. The terminal may be the better candidate for it.

user3917: Consider running the RX and TX of the first UART to the common terminals of an On-Off-On DPDT switch or relay.  Calling the On positions A and B, connect the A terminals to RX and TX of one device, and the B terminals to RX and TX of another device.  Use position A for the first device,  position B for the second device, and the Off position for program loading.
It isn't clear to me whether your debugging is via USB serial or via a separate device. In the former case, a DPST switch would be adequate.  Also, two SPDT's could be used in place of a DPDT if you wish to switch RX and TX separately, or four SPST switches can be used if you have nothing better.
This is premised on the idea that during development you need to be able to send/receive debugging IO.  I don't know how to interpret your
“don't want to be rely on a user having to remove the cable”  phrase, but suppose a user-cabled setup won't need debug-channel switching.

user4143: It's certainly possible to multiplex a UART port, yes, though you will need extra hardware to do it. You will need:

A multiplexer to select between the two RX lines and feed the right one to the Arduino's RX pin
A demultiplexer to select which of the devices to send the Arduino's TX pin to.

"Analog" (de)multiplexers (e.g., CD4052) may be the simplest option since they can work in both directions. Another alternative would be combinations of tri-state buffers and glue logic to control them.

31105: <p>I'm using an Arduino Mega which has 4 RX/TX UARTS/serials.
3 RX's of them I use for MIDI In 
2 TX's of them I use for MIDI Out (maybe later a DMX out too)</p>

<p>One I use currently for debugging. On the other hand, in the future I want:</p>

<ul>
<li>Using an ESP8266 WIFI which also seems to use an UART (both RX/TX)</li>
</ul>

<p>Of course I can remove the debugging RX/TX, but maybe some more additions are needed and for the first RX/TX I need to remove the RX each time I upload (so I rather leave it for debugging).</p>

<p>I was wondering, is it possible to share an UART if I don't use the WIFI module and MIDI port at the same time?</p>
 313: <p>If your application can tolerate the limitations of <a href="https://www.arduino.cc/en/Reference/SoftwareSerial" rel="nofollow noreferrer">SoftwareSerial</a>, it's the easiest way to add a port. The terminal may be the better candidate for it.</p>
 3917: <p>Consider running the RX and TX of the first UART to the common terminals of an On-Off-On DPDT switch or relay.  Calling the On positions A and B, connect the A terminals to RX and TX of one device, and the B terminals to RX and TX of another device.  Use position A for the first device,  position B for the second device, and the Off position for program loading.</p>

<p>It isn't clear to me whether your debugging is via USB serial or via a separate device. In the former case, a DPST switch would be adequate.  Also, two SPDT's could be used in place of a DPDT if you wish to switch RX and TX separately, or four SPST switches can be used if you have nothing better.</p>

<p>This is premised on the idea that during development you need to be able to send/receive debugging IO.  I don't know how to interpret your
“don't want to be rely on a user having to remove the cable”  phrase, but suppose a user-cabled setup won't need debug-channel switching.</p>
 4143: <p>It's certainly possible to multiplex a UART port, yes, though you will need extra hardware to do it. You will need:</p>

<ul>
<li>A multiplexer to select between the two RX lines and feed the right one to the Arduino's RX pin</li>
<li>A demultiplexer to select which of the devices to send the Arduino's TX pin to.</li>
</ul>

<p>"Analog" (de)multiplexers (e.g., CD4052) may be the simplest option since they can work in both directions. Another alternative would be combinations of tri-state buffers and glue logic to control them.</p>
