In this article, you should be able to set up L2TP VPN to Auto Start and connect automatically to our service on a Mac OS X system
Note: If you're using Tunnelblick (OpenVPN) or PPTP VPN, please click on the links below.
First of all, you will need to ensure that you've set up L2TP VPN on your Mac System. If you haven't, please click on the link below to set it up.
Creating Auto Start Script
Launch Finder, navigate to Applications followed by Utilities and click on Script Editor.
You will now have a blank script box. Next, Copy and Paste the script which is highlighted below in red color into the blank box.
Important: In this example, the L2TP VPN connection name that we have set up is called MPN USA. If you have different connection name, you MUST replace "MPN USA" with your VPN connection name in the script below. You may have to rewrite the quotation marks.
tell application "System Events"
tell current location of network preferences
set myConnection to the service "MPN USA"
if myConnection is not null then
if current configuration of myConnection is not connected then
This is how the script should look like when it's pasted into the blank script box.
Once you've added the script into the blank box, you will need to save it. To do so, simply click on File menu at your taskbar and choose Save.
When you choose to save the script file, it will prompt you the following screen. Please enter the details as per below and click on Save.
Save As: MPN USA AutoConnect (Or any name that you've set)
Where: Applications folder
File Format: Application
Options: Stay open after run handler is checked
Setting up script to run in background
Go to the script that you've saved earlier by launching Finder, navigate to Applications folder and right click on MPN USA AutoConnect or any name that you've saved as and choose Show Package Contents.
Note: If you can't right click on the file, simply press and hold the Control button on your keyboard followed by a single click on your mouse.
Now, double click on Contents followed by a right click on info.plist file, choose Open With and click on Xcode programme.
Note 1: You will need Xcode or another PList editor to edit this file. If you wish to download Xcode programme, they can be found at the link below:
Note 2: If you've installed Xcode programme on your Mac and it is not showing up, right click on info.plist file again, choose Open With followed by Other option. Now you should be able to find Xcode in the application list.
Once you've opened the info.plist file, go to your taskbar, click on Editor followed by Add Item.
Next, choose Application is agent (UIEIement) from the drop down menu.
Then, at the Application is agent (UIEIement) key, choose YES from the drop down value menu.
Finally save the script. To do so, click on File menu at your taskbar and choose Save.
Adding L2TP VPN to Auto Start
Click on the Apple icon on your taskbar, choose System preferences followed by Users & Groups. Next, click on the Lock Icon at the bottom left so that you can make changes and you may need to enter your computer's password. Once that is done, click on Login Items and the (+) plus icon.
You will now need to locate the script that you've saved earlier and click on Add. In this example, my script is called MPN USA AutoConnect which I have saved in the Applications folder.
Once you've added the script into the Login Items, please ensure there is a check mark on your script. Finally, click on the Lock Icon at the bottom left again to prevent further changes.
That's it! You can Restart your Mac now and the L2TP VPN will automatically start and connect to our service.
Unfortunately, it doesn't always go to plan!
If you have any problems or can't get connected, please email us at firstname.lastname@example.org. We'll get back to you as soon as possible and try to help.