The Robservatory

Robservations on everything…

 

Using network locations in macOS Ventura

This weekend, I finally migrated my 2019 5K iMac from Mojave to Ventura. There were many reasons for remaining on Mojave, starting with the fact that I liked the OS and it worked very well for me. But I also had a couple 32-bit apps I relied on, as well as a number of 32-bit games I enjoyed playing now and then. As time went on, though, there were more and more current apps that I couldn't update to the latest versions, as they all required something newer than Mojave.

(I wasn't a complete macOS luddite—my 14" MacBook Pro runs Ventura, and that's what I use when supporting Many Tricks customers.)

After the update, I remembered one of the bugaboos about Ventura: Apple, in their infinite wisdom, removed the Locations feature from the Network System Settings panel.

I use locations a lot, as they make it easy to switch between various network configurations. In my case, I have locations created that enable or disable my ad blocker, change my settings for when I'm on my VPN, one I need to use to set up my mesh router, and another for when I'm traveling. All of that seemingly gone.

The good news, sort of, is that they're not really gone. If you had existing locations before installing macOS Ventura, you'll find them listed in a sub-menu in the Apple menu. (Note that they've been in the Apple menu a long time; I just never knew about it!)

This location for Locations makes a lot more sense, as it's much easier to get to. However, if you didn't have any locations, or you want to add, delete, or modify your locations, it appears you're out of luck, as there's no GUI to do any of that. But we do still have Terminal, and the locations code itself is still in macOS.

(I found the following in this post on Apple's discussion forum, but I'm replicating the key bits here in case that post ever vanishes.)

The key command is networksetup, and here are the relevant options from the man page:

 -listlocations
         List all network locations.

 -getcurrentlocation
         Display the name of the current set.

 -createlocation location [populate]
         Create a set with the user-defined-name name and optionally populate it with the default services.

 -deletelocation location
         Delete the set.

 -switchtolocation location
         Make the specified set the current set.

At this point, I haven't actually used any of these commands yet. From what I can tell, if you want to create a new location, you'd first use the createlocation option—if you include the populate bit, it will be created with default network settings, otherwise, it will be completely empty.

You'd then use the Locations entry in the Apple menu to select the new location, then open System Settings > Network and configure that location. I'm assuming that when you click OK and close the Network panel that all your changes are then saved with that location, but as noted, I haven't yet played around with this to see exactly how it works.

11 Comments

Add a Comment
  1. I'm pretty sure that the Apple menu locations entry has been there for many years now (10.9+ certainly), but as you identified its content has always been manipulated via the pref panes.

    I've found networksetup to be fantastically useful in scripts over the years, including toggling the WiFi sub-system totally off/on via -setairportpower, which proved very useful while remote troubleshooting many flakey router/repeaters.

    1. I've confirmed that the Locations submenu is in the Apple Menu in 12.6.1 (when you have multiple locations configured). My memory, confirmed by the Wikipedia image, is that the Location submenu was there from the very first (re)appearance of the Apple menu in Mac OS X 10.0. The same functionality was in a control strip module in Mac OS 9, as I was reminded by John Siracusa's review of 10.0.

      https://en.wikipedia.org/wiki/Mac_OS_X_10.0#/media/File:MacOSX10-0screenshot.png

      1. Thanks to both of you—as I hardly ever use the Apple menu, I never thought to look there :).

        -rob.

      2. Funny - I just spent the last hour getting SheepShaver to run, so that I could check where it was in Mac OS 9. I thought I remembered it being in the Apple menu, but so far I only see it in the control strip.

  2. For my computer labs, I setup locations entirely by the command line. We want Ethernet only, no Wi-Fi, so I don't use the populate option. We are also setting fixed IP addresses. So my shell script looks something like this (suitably redacted):
    networksetup -createlocation FixedIP
    networksetup -switchtolocation FixedIP
    networksetup -createnetworkservice Ethernet en0
    networksetup -setmanual Ethernet 10.20.30.101 255.255.255.0 10.20.30.1
    networksetup -setdnsservers Ethernet 10.20.30.4 10.20.30.44
    networksetup -setsearchdomains Ethernet x.example.com

    The good news is that this command sequence does not touch the "Automatic" location which is there by default, so as soon as I add this location, Apple Menu > Locations becomes visible.

  3. They added Locations as a feature back in the 13.1 beta so should be back in the next point release.

    1. Huh, you mean you've seen it in the 13.1 beta and can confirm that it offers switching options as it did pre-13? That saves me from starting a little prefpane project on my own (BTW, can we still write custom prefpanes, or is that also not possible any more?)

Leave a Reply

Your email address will not be published. Required fields are marked *

The Robservatory © 2022 • Privacy Policy Built from the Frontier theme