Whether you need to add ACCEPT to OUTPUT rules, INPUT rules or both depends on what you have already configured, because by default nothing is blocked.
It is common practice to allow all processes on the box to talk to all other processes on the same box via the loopback address.
Code:
iptables -A INPUT -i lo -J ACCEPT
You also need to add an OUTPUT clause if you chose to block outgoing traffic as well.
The nice thing about this is that it covers all protocols and the port number question goes away.