Not able to open a port OS X El Capitan 10.11.3

Posted on


I followed the instructions mentioned in the following blog to open a port on Mac. But i see still see that my port is closed after following all these instructions. Is there any change that needs to be done for OS X Elcapitan ? Any help is appreciated/

nmap -p 1234 localhost

This will output the status ..

Nmap scan report for localhost ( Host is up (0.00013s latency). PORT STATE SERVICE 1234/tcp closed ppp

To open this port, add the following line in /etc/pf.conf sudo vim /etc/pf.conf

Open port 1234 for TCP on all interfaces

pass in proto tcp from any to any port 1234

You can limit the ip addresses .. replace any with allowed addresses ..

Save the file.

Restart the Mac and run nmap command to see if the port is open/


Are you running any application which is listening on port 1234? Even if the port is not blocked by pf, it will still show as closed if no-one has opened it.

For example, after unblocking the port as above, in one terminal execute

$ nc -l 1234

to have nc listen for incoming connections on port 1234. (Nothing will happen, and you won’t get a prompt back, because netcat is just… listening.) Then, in another terminal, run your

$ nmap -p 1234 localhost

This should show the port as open.

Leave a Reply

Your email address will not be published. Required fields are marked *