Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am familiar with the route add default gw command in Linux to add a default gateway, but this doesnt work on Mac OS. I cant find any appropriate example in the route manual. Can anyone help me the command.

share|improve this question

migrated from Dec 6 '11 at 23:45

This question came from our site for professional and enthusiast programmers.

Or how to make the IP address of one interface the default gateway? – SThomas Jul 21 '11 at 22:10

route delete default

route add default


route change default -interface $INTF

route change -interface $INTF

share|improve this answer
is it possible to bind a route to a network environment ? – YoshiBotX Nov 28 '14 at 12:23

If you are intent on using route the man page for route will show you it's the same as most BSD route commands. You may need ip6config (and man page) as well if you care about IPv6 routing.

The "mac" way is to set it from the System Preference pane under network and is preferred over using unix commands since it honors location changes and other events such as a reboot.

manual TCP/IP configuration

share|improve this answer
But in that very screenshot, you will get an error message if you press "OK" since this method also require you to set a manual IPv4 Address, which might not be desirable. – Fuzzy76 Apr 14 '15 at 12:28
@Fuzzy76 Yes - if you manually set an unworkable network, your network will not work. The Router here is fine though since that is the default gateway equivalent to the answer on how to change things from the command line. – bmike Apr 14 '15 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.