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).
I also tried netstat -nr | grep 'default'
, but I was hoping for a cleaner output like that produced by route -n
in Linux/Unix. netstat -nr
lists all the interfaces and the default gateway for them.
Any kind of suggestion or a hint in the right direction will be appreciated.
See Question&Answers more detail:os