How can I automatically login to captive portals on OS X?

A captive portal is used by (often not password-protected) wireless networks that present a web page as soon as you connect to them, requiring you to login.

I have to login to different wireless networks like this very frequently, and none of the captive portals seem to remember my login/password information. Is there a way to automate the login process somehow, or at least store the login/password pairs in the Keychain?

Update: There’s an iOS app called AutoWifi that basically handles this. If it’s possible to do this on iOS with all its restrictions, surely it must be possible to do something like it on OS X, right?

Related fun fact: This is how Apple tests for captive portals on OS X and iOS:

OS X and iOS make a request to http://www.apple.com/library/test/success.html every time you connect to a WiFi network.

As of Yosemite the URL is now: http://captive.apple.com/hotspot-detect.html

This URL returns the following HTML:

  • 1
    Take a look at /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist. Manipulating the preferences here can easily compound serious security risks on top of the many Apple has decidedly implemented on their own. I'm not sure which browser you use to connect via these captive portals, but you can also try setting up network locations for them, or creating a simple macro depending on what you want to auto-fill.
    – l'L'l
    Commented Apr 5, 2012 at 17:46
  • 2
    That’s the thing — whenever OS X detects a captive portal, it opens a WebView popup window (not a real browser UI) with the login page. Commented Apr 6, 2012 at 5:53
  • If you have a chance post the source code of the popup.
    – l'L'l
    Commented Apr 6, 2012 at 6:30
  • 2
    None of the answers answers the question!
    – Tyilo
    Commented Jun 22, 2013 at 11:28
  • 1
    related stackoverflow.com/questions/14606131/…
    – cwd
    Commented Aug 3, 2014 at 13:36

9 Answers 9


Update: note that question was asked and answered in 2012, a lot has changed in the OS since that time, including SIP, which prevents the renaming proposed here. The answer below by @cwd is now the recommended way as it doesn't need disabling of SIP...

You can rename

/System/Library/CoreServices/Captive Network Assistant.app


/System/Library/CoreServices/No More Captive Network Assistant.app

and you're all set. Password entering now goes via your browser of choice and can be stored using 1password or other plugins. Note that if you were already logged in while doing the renaming, it may take some time for your session to expire...

  • 1
    Looking forward to testing this out :) No downsides? Commented Dec 11, 2012 at 21:51
  • 1
    While this may be simple(st?) solution, I would think cwd's answer is the proper way to do it even though it's admin-ish. There are certain things on Mac that Apple kind of forces us to be admin-ish on, when we want to "think different" from Apple.
    – David
    Commented Jul 7, 2015 at 19:14
  • On newer versions of macOS, you will need to disable System Integrity Protection before you are able to rename this file. I'm not opposed to renaming system stuff when necessary, but cwd's answer is better in this case. Commented Feb 17, 2019 at 6:06

Just found this Disable Captive Network Support in OS X

Which mentions "To disable it, set this preference:"

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -boolean false

In case, you would ever want to remove this setting, you can do:

sudo defaults delete /Library/Preferences/SystemConfiguration/com.apple.captive.control Active

Then, as @Leon mentions, use the regular web browser to login. Or if you are on a network where that somehow does not work then you can still try and open the app manually ( located at /System/Library/CoreServices/Captive Network Assistant.app )

  • 2
    cwd++ This is still the best answer. Today on Mojave, I was unable to rename or delete the Captive Network Assistant.app, but I was able to force the disabling via defaults
    – danielpops
    Commented Nov 10, 2018 at 21:15

Tyilo's NetworkAutoLogin project on github is an os.x daemon that "Automagically logs into to Captive Portal Networks" with user-supplied credentials.

It uses PhantomJS & CasperJS to post the necessary info to the fields on the captive portal login page. Could be the secret login "password", a username-password pair, or just activating a EULA checkbox and the "connect" button.

I can't remember exactly how it is triggered, but it registers a .plist with launchctl.

You put configuration options in a json file, specifying the name of the fieldset (optional) on the captive portal page and the necessary fieldname + content pairs (required). Here's an example of the config file stored in ~/.networkautologin.js

{ // Example with all possible options
    match: {
        SSID: ['Example WiFi 1', 'Example WiFi 2'],
        BSSID: '01:23:45:67:89:AB',
        URL: 'http://logon.example.org/?url=http://www.apple.com/library/test/success.html'
    form_selector: 'form#login_form',
    fields: {
        'username': 'test',
        'password': '123123'
  • 1
    not crazy that it requires yet another daemon to be running in the background
    – cwd
    Commented Aug 3, 2014 at 13:47
  • I have compiled it but have been unable to observe the daemon trigger when presented with a preset captive network login page.
    – Mac Cowell
    Commented Aug 12, 2014 at 22:26
  • Likewise (even updated it to the new settings in yosemite+)
    – Jeef
    Commented Jan 8, 2016 at 16:06

Doesn't deleting (or renaming) /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist stop the auto-probing?

It could at least stop the opening of the WebView popup.

Otherwise replace all URLs in that Settings.plist with a local hosted copy of the success.html file and host the success.html file on your localhost webserver.


I seeing captive portal requests on my home network every 5 min. But I've changed in file /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist

string: http://www.apple.com/library/test/success.html to http://captive.apple.com/hotspot-detect.html (I meant ProbeURL section). apple changed probe URL for new OS, I do not know why, but new URL response is 200 (OK) and should works (I've faced with same problem on my mbp 2011 Mavericks).


With some help using AppleScript, Lynx, Fakeapp/Safari, and ControlPlane, My MacBook now always connected to captive portal automatically in my office. It still not an efficient way to make it, but it still get the job done perfectly. I hope someone can make it simpler.

Here's the code:

  1. Make sure we are in correct SSID

    do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ SSID: / {print $2}'"
  2. Check captive portal address existence

        do shell script ("ping -c 2 " & CaptiveAddress) -- set your captive address here
        set CaptiveExist to "yes"
    on error
        set CaptiveExist to "no"
    end try
  3. Test portal connection

        set PortalOpened to do shell script ("/usr/local/bin/lynx --dump http://www.apple.com/library/test/success.html | grep 'Success'")
        if PortalOpened is "   Success" then
            set PortalOpened to "yes"
            set PortalOpened to "no"
        end if
    on error
        set PortalOpened to "no"        
    end try
  4. Logging in to portal

    tell application "Fake"
        load URL "http://YourPortalAddress.html" -- put your captive address here
        set value of element with name "username" to "user"
        set value of element with name "password" in form with name "password" to "password"
        click element with id "logincaption"
    end tell
  5. Save those scripts as one application. Then use ControlPlane rules to make it run when triggered with specified SSID.

Surely login form on captive may have another HTML elements. You can add some display dialogs or notifications, another different SSID with it's own HTML elements and username/password. Fake is a browser+automator, so it will make life easier.

Don't forget to disable captive login popup. Now your Mac 100% autoconnect to the portal.

Hope that helps.


Although a few years old this question and answer shows high in googling this. Unfortunately MacOS has changed since then. This page on MacWorld from 2016 seems to describe the current (as of this writing) state.

Which essentially is that because of SIP you can disable the assistant only in recovery mode. I have yet to find any solution to the other part of this question, "can we automate the login?"

  • 1
    In High sierra it no longer seems possible to rename Captive\ Network\ Assistant.app as suggested there. At least I could not even when running as root. Commented Jan 4, 2018 at 8:22
  • You need to disable that latest MacOS operating protection feature. support.intego.com/hc/en-us/articles/… I do not know if this approach still works, but at least you now can try. Commented Nov 23, 2018 at 3:01

A captive portal is not like a password. It's more like a sign in sheet. Every time the network you're connected to hands out an IP address through DHCP, it gives you the captive portal to sign into/agree to and then it allows you to connect. From what I understand, this is a cross platform restriction that cannot be altered. It may be something that the network administrators can change, but even that may depend on the type of equipment being used.

  • You’re absolutely right that it’s more like a sign-in sheet than a password, but I’m surprised there doesn’t seem to be an easy way to autofill this sheet :) On iOS, there are apps that can take care of this. Isn’t there anything similar for OS X? Commented Mar 23, 2012 at 12:33
  • What apps for iOS can do this? Wouldn't you then have to use that app for web browsing, etc.?
    – Matt Love
    Commented Mar 23, 2012 at 12:36
  • 1
    The AutoWiFi app handles this automatically; all you have to do is click “Connect” once and you’re logged in. Commented Mar 23, 2012 at 12:40

You can use Mili, an open-source tool I wrote for auto login hotspot pages. It also works on Linux.

When you change your Wi-Fi connection, Mili checks for Mikrotik services and then attempts to log in with your login information.

You can also use multi-login information like this:

    "username": "USER 1",
    "password": "PASS 1",
    "share": 5
    "username": "USER 2",
    "password": "PASS 2",
    "share": 1
  • Welcome to Ask Different. Site rules require that you indicate in your answer if you're affiliated with the software you're recommending. In this case, you're the author but you don't state this in your answer. Please see How to Answer for info on providing answers here and edit your answer to include the missing info.
    – fsb
    Commented Feb 16, 2019 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .