MacPorts to automatically install dependencies
MacPort's port is reasonable documented so on of the normal ways to find help
e.g.

man port

port help


will give the way

-N
Non-interactive mode, interactive questions are not asked

So run
sudo port -N install &lt;portname&gt;