Can you rename the "Automatic" network location with the networksetup command?

kmitnick
New Contributor III
New Contributor III

I need a way to rename the "Automatic" network location to "Work" via the command line.

I had a look at the man page for networksetup but don't see anything that would help.

Has anyone found a way to accomplish this?

Any advice is greatly appreciated.

Thanks

Keith

1 ACCEPTED SOLUTION

nkalister
Valued Contributor

unless you've customized automatic, that location is just the bare defaults that would be applied to any new location.
so, don't rename it- make a new location named whatever you want, then delete the automatic location.

networksetup -createlocation Work populate
networksetup -switchtolocation Work
networksetup -deletelocation Automatic

View solution in original post

5 REPLIES 5

nkalister
Valued Contributor

unless you've customized automatic, that location is just the bare defaults that would be applied to any new location.
so, don't rename it- make a new location named whatever you want, then delete the automatic location.

networksetup -createlocation Work populate
networksetup -switchtolocation Work
networksetup -deletelocation Automatic

nessts
Valued Contributor II

nice and concise @nkalister
after that you might want to loop on each service and set proxies, turn off IPv6 etc, since you're there and messing with stuff anyway :)

kmitnick
New Contributor III
New Contributor III

nkalister,

I appreciate your prompt response. I was able to get it working in the past with what you recommended, but was curious to know if there was a way to rename the Automatic location without deleting it. If not, your way does indeed work.

Thanks

Keith

nkalister
Valued Contributor

Keith, AFAIK there is no way to rename it. there are no documented switches for networksetup that'll do it.

and good point, nessts . . .best way to handle this in a workflow is to configure your locations first, then set your settings within the locations. Scripts like that are where I learned do loops and iterating though the contents of arrays! good times.

kmitnick
New Contributor III
New Contributor III

@nkalister,

I'm marking your post as the answer. I appreciate everyones input.

Thanks

Keith