I have a local network set up at my university in the makerspace (called IoT_IRL), but the rest of the university uses eduroam.  I want to auto-connect to both, but IoT_IRL should have priority when I'm in the makerspace, and Apple has made it such that priority is no longer something you can set in their GUI (it will just connect to any 'preferred network' with the strongest signal, which is never the one I want).

To fix this, I had to:

1.  Figure out the security type of the two networks.

Connect to each network, then use airport to get the security type. Note it

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I

For me, eduroam lists ft-wpa2 and IoT_IRL lists wpa3-sae.

1.  Remove and re-add them to en0 at different priority levels.

Now remove them both and add them back at different priorities; using 1 for the higher and 3 for the lower priority.  Note the security setting types, network name, and priority level from above here:

networksetup -removepreferredwirelessnetwork en0 eduroam
networksetup -removepreferredwirelessnetwork en0 IoT_IRL
networksetup -addpreferredwirelessnetworkatindex en0 IoT_IRL 1 wpa3-sae
networksetup -addpreferredwirelessnetworkatindex en0 eduroam 3 ft-wpa2