MacOS Add new WiFi profile programmatically

Hello,

I'm struggling to find a way, on how to add a new WiFi profile (SSID & password, that are in System Preferences > Network > Wi-Fi > Preferred Networks) programmatically, on MacOS (preferably something that'd work on obj c).

This is if some device would host a wifi hotspot, the Mac could connect to it automatically, or atleast the password would be already present (assuming there's no wifi connection already present).

In a mac Catalyst app, you could try creating an NEHotspotConfiguration for your WiFi network, then "apply" it using NEHotspotConfigurationManager.

I'm not sure if that would work, but it might be worth a try.

In a mac Catalyst app, you could try creating an NEHotspotConfiguration for your WiFi network, then "apply" it using NEHotspotConfigurationManager.

You will run into issues using NEHotspotConfiguration in Mac Catalyst because while the symbols are available, the entitlements for:

<key>com.apple.developer.networking.HotspotConfiguration</key>
<true/>
<key>com.apple.developer.networking.wifi-info</key>
<true/>

Regarding:

I'm struggling to find a way, on how to add a new WiFi profile (SSID & password, that are in System Preferences > Network > Wi-Fi > Preferred Networks) programmatically, on MacOS (preferably something that'd work on obj c).

You could try looking a associateToNetwork in CoreWLAN on the macOS side to see if this gets you closer to what you are looking for.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Hello @meaton, thank you for your answer!

You could try looking a associateToNetwork in CoreWLAN on the macOS side to see if this gets you closer to what you are looking for.

I've tried to use associateToNetwork, and it works if it's an existing Network (aka currently available). However, at the time of this operation, I'm configuring the device, and it's network (WiFi) is not available yet.

I've tried digging through Core WLAN framework, but it doesn't seem like it's possible to associate to not available network. Do you have any other tips on leads, regarding this issue?

MacOS Add new WiFi profile programmatically
 
 
Q