Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

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 have a two locations set up on my macBook. One for normal use and another for when I use a proxy, which I start from the command line. It would be very useful for me to be able to switch network location from the command line at the same time. Is this possible?

share|improve this question
I was about to ask this question, when I see it was already asked. This is my exact same situation. My name is also Joe. Are you future-me come back to help now-me? – JShoe Sep 16 '13 at 23:56
@JShoe I can't tell you that. But you should definately avoid anyone with a tatoo of a goldfish. – Joe Sep 20 '13 at 9:50
up vote 13 down vote accepted

Yep, pretty easy too. You may need to 'sudo' the command depending on your system's configuration.

networksetup -switchtolocation "location name"

There are some other options, too:

networksetup -getcurrentlocation
networksetup -listlocations
networksetup -createlocation <location name> [populate]
networksetup -deletelocation <location name>
networksetup -switchtolocation <location name>
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.