def autoconfig_url_from_preferences():
    """
    Get the PAC ``AutoConfigURL`` value from the macOS System Preferences.
    This setting is visible as the "URL" field in
    System Preferences > Network > Advanced... > Proxies > Automatic Proxy Configuration.

    :return: The value from the registry, or None if the value isn't configured or available.
        Note that it may be local filesystem path instead of a URL.
    :rtype: str|None
    :raises NotDarwinError: If called on a non-macOS/OSX platform.
    """
    if not ON_DARWIN:
        raise NotDarwinError()

    try:
        config = SystemConfiguration.SCDynamicStoreCopyProxies(None)
    except AttributeError:
        return  # Key or value not found.

    if all(('ProxyAutoConfigEnable' in config,
            'ProxyAutoConfigURLString' in config,
            not config.get('ProxyAutoDiscoveryEnable', 0))):
        # Only return a value if it is enabled, not empty, and auto discovery is disabled.
        return str(config['ProxyAutoConfigURLString'])
Get the PAC ``AutoConfigURL`` value from the macOS System Preferences.
    This setting is visible as the "URL" field in
    System Preferences > Network > Advanced... > Proxies > Automatic Proxy Configuration.

    :return: The value from the registry, or None if the value isn't configured or available.
        Note that it may be local filesystem path instead of a URL.
    :rtype: str|None
    :raises NotDarwinError: If called on a non-macOS/OSX platform.