Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving the SSID on macOS #13

Open
richb-hanover opened this issue Jan 29, 2025 · 0 comments
Open

Retrieving the SSID on macOS #13

richb-hanover opened this issue Jan 29, 2025 · 0 comments

Comments

@richb-hanover
Copy link

ChatGPT sez...

In macOS 15.3, Apple has further restricted access to the SSID for privacy reasons. The system now redacts the SSID unless the application has explicit location permissions.

How to Fix This

To retrieve the SSID successfully, you must grant location access to your terminal or script:

Step 1: Grant Terminal Location Access

  1. Open System SettingsPrivacy & SecurityLocation Services.
  2. Scroll down to Terminal (or iTerm, VSCode, etc.).
  3. Enable Location Services for your terminal.
  4. Restart your terminal and try running the commands again.

Alternative: Use CoreWLAN with Full Permissions

If you’re writing a program, using Swift or Python with CoreWLAN (with location permission granted) still works.

Swift Code

import CoreWLAN

if let interface = CWWiFiClient.shared().interface(),
   let ssid = interface.ssid() {
    print("Connected to WiFi: \(ssid)")
} else {
    print("Not connected to WiFi")
}

Ensure your app has the com.apple.developer.networking.wifi-info entitlement.

Python Code (Requires pyobjc)

from CoreWLAN import CWWiFiClient

wifi_client = CWWiFiClient.sharedWiFiClient()
interface = wifi_client.interface()
ssid = interface.ssid() if interface else None

if ssid:
    print(f"Connected to WiFi: {ssid}")
else:
    print("Not connected to WiFi")

Before running:

pip install pyobjc-framework-CoreWLAN

Run this script from a terminal with Location Services enabled.


Why Is macOS Hiding the SSID?

  • Apple has increased privacy protections in macOS 15.
  • Without location permission, all system commands (networksetup, airport, ioreg, etc.) return "<SSID Redacted>".
  • Only apps with explicit permission can read the SSID.

Final Solution

  1. For CLI commands: Enable Location Services for your terminal.
  2. For Swift/Python apps: Use CoreWLAN and request WiFi Info Entitlement if needed.
  3. For automation: Use a script running inside a signed & notarized app with proper entitlements.

Would you like a guide to create a signed script with the necessary permissions? 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant