How to Use the macOS scselect Command to Switch Network Locations in the Terminal

The Problem with Changing Wi-Fi Environments

If you use a MacBook for work, you likely move between vastly different network environments.

At the office, you might need a static IP address, strict corporate DNS servers, and specific web proxies configured in order to access internal company resources. But when you take that same MacBook home, or to a local coffee shop, those corporate settings will prevent you from connecting to the internet. You need standard DHCP and public DNS servers.

Clicking through System Settings > Network > Details every single time you change locations to manually swap out DNS and IP settings is incredibly tedious.

macOS solves this with “Network Locations,” allowing you to save distinct profiles (e.g., “Office”, “Home”, “Coffee Shop”) and switch between them. While you can switch these from the Apple menu, power users and system administrators can automate this process instantly from the terminal using the scselect (System Configuration Select) command.

Step 1: Setting Up Network Locations in the GUI

Before you can switch locations in the terminal, you must first create them in the macOS graphical interface.

  1. Open System Settings.
  2. Click on Network in the left sidebar.
  3. Scroll to the bottom and click the (More) button, then select Locations > Edit Locations…
  4. Click the + button to add a new location (e.g., “CorporateHQ”).
  5. Select that new location, configure all your static IPs and DNS settings, and click OK.
  6. Repeat the process to create a “Home” location set to standard Automatic DHCP.

Step 2: Listing Available Locations via Terminal

Once your profiles are built, open the Terminal application.

To see a list of all available network locations you have configured on your Mac, simply type the command by itself:

scselect

The output will display the unique alphanumeric UUID for each location, an asterisk (*) next to the one currently active, and the human-readable name in parentheses.

Defined sets include:
  01B23C45-D678-90EF-1234-56789ABCDEF0  (Home)
* 98F76E54-D321-09FE-8765-43210FEDCBA9  (CorporateHQ)
  Automatic

Step 3: Switching Network Locations instantly

To switch to a different location, type scselect followed by the name of the location you want to activate.

Because you are changing system-wide network routing rules, you may need to use sudo depending on your Mac’s security configuration, though it often works without it.

scselect Home

The terminal will instantly respond with:

CurrentSet updated to 01B23C45-D678-90EF-1234-56789ABCDEF0 (Home)

In less than a second, your Mac has dropped the static IP, flushed the corporate DNS, acquired a new IP address via DHCP, and re-routed your internet traffic.

Step 4: Automating the Switch with Scripts

The true power of scselect is automation.

If you are a developer, you might have a script that connects to your corporate VPN, mounts internal network drives, and launches your development environment.

By adding scselect CorporateHQ to the very beginning of that bash script, you ensure that your Mac is in the correct networking state before attempting to connect to the internal servers, completely eliminating “server not found” errors caused by forgetting to switch locations manually.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.