title: How to get default gateway in Mac OSX
body: <p>I need to retrieve the default gateway on a Mac machine. I know that in Linux route -n will give an output from which I can easily retrieve this information. However this is not working in Mac OSX(Snow Leopard). </p>
  
  <p>I also tried <code>netstat -nr | grep 'default'</code>, but I was hoping for a cleaner output like that produced by <code>route -n</code> in Linux/Unix. <code>netstat -nr</code> lists all the interfaces and the default gateway for them.</p>
  
  <p>Any kind of suggestion or a hint in the right direction will be appreciated.</p>