OS X - PPTP VPN Auto Start

Share This!

In this article, you should be able to set up PPTP VPN to Auto Start and connect automatically to our service on a Mac OS X system

Note: If you’re using Tunnelblick (OpenVPN) or L2TP VPN, please click on the links below.

OS X – Tunnelblick (OpenVPN) Auto Start

OS X – L2TP VPN Auto Start

First of all, you will need to ensure that you’ve set up PPTP VPN on your Mac System. If you haven’t, please click on the link below to set it up.

OS X PPTP VPN Setup


Creating Auto Start Script

 

Launch Finder, navigate to Applications followed by Utilities and click on Script Editor.

 

 

Mac OS X PPTP VPN Auto Start 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 PPTP 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.

 

on idle
    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
                    connect myConnection
                end if
            end if
        end tell
        return 120
    end tell
end idle



This is how the script should look like when it’s pasted into the blank script box.

Mac OS X PPTP VPN Auto Start Script

 

 

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.

 

Mac OS X PPTP VPN Auto Start Save Script

 

 

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

 

Mac OS X PPTP VPN Auto Start Script Settings

 


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.

 

Mac OS X PPTP VPN Auto Start Editting Script

 

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:

 

Mac App Store – Xcode

 

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.

 

Mac OS X PPTP VPN Auto Start Xcode editor

 

 

Once you’ve opened the info.plist file, go to your taskbar, click on Editor followed by Add Item.

 

Mac OS X PPTP VPN Auto Start Xcode add a script

 

 

Next, choose Application is agent (UIEIement) from the drop down menu.

 

Mac OS X PPTP VPN Auto Start Xcode add value

 

 

Then, at the Application is agent (UIEIement) keychoose YES from the drop down value menu.

 

Mac OS X PPTP VPN Auto Start Xcode add a value

 

Finally save the script. To do so, click on File menu at your taskbar and choose Save.

 

Mac OS X PPTP VPN Auto Start saving xcode script

 



Adding PPTP 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.

 

 

Mac OS X PPTP VPN add into login items

 

 

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.

 

Mac OS X PPTP VPN Auto Start application script

 

 

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.

 

Mac OS X PPTP VPN Auto Start script added into login items

 

 

That’s it! You can Restart your Mac now and the PPTP VPN will automatically start and connect to our service.

 


Any Problems?

Unfortunately, it doesn’t always go to plan!

 

If you have any problems or can’t get connected, please email us at [email protected]. We’ll get back to you as soon as possible and try to help.