I'm trying to add multiple persistent static routes using the networksetup command. I've used this method in the past and am now running into a strange issue, where I only seem to be able to add 1 route. For instance, if I go to add another route the previous route will be overwritten with the new.

I've only recently started using this method of adding routes to OSX. Is this normal behaviour?

Here are the commands I'm using:

# networksetup -setadditionalroutes "Ethernet 1"

Then when I run getadditionalroutes, it will only display the last entered route. For example…

# networksetup -getadditionalroutes "Ethernet 1"
# networksetup -setadditionalroutes "Ethernet 1"
# networksetup -getadditionalroutes "Ethernet 1"

What is the best way for me to achieve my goal?

  • First, what version of OSX are you using? Second would you accept other methods/tools to add your route besides networksetup? Finally, what does netstat -r output? – MERM Jan 12 '17 at 16:04

If you want to set additional routes either add all routes:

networksetup -setadditionalroutes "Ethernet 1"

or set a variable with the existing additional routes:

ADDITIONALROUTES=$(networksetup -getadditionalroutes "Ethernet 1")

which yields e.g.


and then use

networksetup -setadditionalroutes "Ethernet 1" $ADDITIONALROUTES

to add other routes without loosing the old routes.

  • Aha! Thank you very much, I've done what you suggested in your second line - add all the routes in one command. Cheers – Huckleberry Finn Jan 12 '17 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .