As long as you do not deliberately invoke the MacOS firewall (which is completely unnecessary) ALL ports are already open on your Mac.
Your Mac is protected from attack over the internet by a Network/Router feature called Network Address Translation.
In Internet networking, a private network is a computer network that uses a private address space of IP addresses. These addresses are commonly used for local area networks (LANs) in residential, office, and enterprise environments.
from:
https://en.wikipedia.org/wiki/Private_network
IPv4 Addresses in the range of 192.168.xxx.yyy, 10.xxx.yyy.zzz, or 172.16.xxx.yyy are NOT available for use on the Internet at large. To send a message on the Internet, your Router acts as your agent, substitutes its own, network-visible address, and sends out requests on your behalf. any unsolicited incoming requests are discarded by default, unless you enable port forwarding aka open a port on your router.
So when we talk about 'Opening a Port', this ALWAYS means a port on your Router, and in addition to Opening, you need to specify what local IP address the requests that come in, tagged with that port number, are to be sent. In general, when you forward a port, you should also commit to manual IP address for the computer to which those requests will be forwarded.
If you have reconfigured or reset you network so that your target computer has received a different DHCP address than previous, these incoming request could be being sent to a different device than before.
In general, the work of opening ports is done on your Router. Ports on your Mac are all already open.
If the software involved were a multi-player game, many of these games use a standard protocol to talk to your Router and do the work of opening the port for you.