Lock your Mac with iPhone

One summer I was talking about the interesting concept of a password manager from Ford. iOS-database developer Scott decided to use a similar approach to automatically lock your Mac whenever he absented himself from the computer and unlock it upon return.

It turned out that to do this in Mountain Lion is quite simple, though a bit more complicated than in previous versions of the apple operating system. You will need a few simple ingredients:

    Mac running OS X. Baz wrote this manual for Mountain Lion, but in the regular Lion trick should also work. Smartphone with integrated Bluetooth (in our case – iPhone). And the basic idea of ??AppleScript.


To get started, users need to go to the System Preferences panel, entitled “Desktop & Screen Saver” and select there saver to your liking. For example, I use here are the simple watch.

In addition, the panel “Privacy and Security” enable checkbox “Require password to wake from sleep or screen saver” and select any time period. It is useful to use a delay of 5 seconds, as this allows you to quickly respond to accidental launch script blocking computer.

Step 1. Script to lock Mac

Next, you create a script AppleScript, which will lock the computer when the user with the phone out of range of Bluetooth. More precisely, to activate the screensaver on the screen, but this is equivalent to blocking, as we have included the option “Require a password.” Call this file iPhoneOutOfRange. scpt :

On run
say "I'll miss you!" using "Milena"
activate application "/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine. app"
end run

As you can see, the line just three runs saver (with the full path to the frameworks). In line 2, you can specify any phrase / voice or no voice instructions to remove.

Step 2. Script for Mac release

To unlock the Mac you want to stop the screensaver and entered into the password of your account. And if the versions of OS X, the previous Lion, it could be done by changing a single variable, but now have to force the system to enter the password for us.

Create the following script and save it with the name iPhoneInRange.scpt :

On run
say "You!" using "Milena"
tell application "/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine. app" to quit
tell application "System Events" to keystroke 125
delay 1
tell application "System Events" to keystroke "YOUR_PASSWD"
delay 1
tell application "System Events" to keystroke return
end run

I think you may have noticed in the script “security gap” that can be solved in three ways:

    Make the script available only to run (while in AppleScript Editor, select the corresponding checkbox) – in this case, you do not edit it. Score and not to worry. Surely someone will dig into the script to find a password on your account? Store the password in the keychain and get it using AppleScript. Unfortunately, Buzz was not able to realize it.

Step 3. Proximity application

Now you need some way to run our script. It is best suitable for this application Proximity – despite the fact that the latest release of the utility was in the distant 2009, it still works well in the Mountain Lion and the usual Lion.

Proximity is available for download from the project page on Google Code (and the source code is published on GitHub). Download and install it just like any other application. You can also add this to the “Login Items” every time the computer.

Step 4. Putting all the elements

After starting Proximity in the menu bar you will see another icon, it is available from the settings window. It requires:

    Set the interval for monitoring devices, say, 20 seconds. Click on the button «Change Device» and create a pair with your iPhone. Most likely, this trick will work with any phone that has a module Bluetooth. With the help of the button «Check Connectivity» can verify that your smartphone is connected to the computer correctly. In the «Out of Range Script» install script created in step 1, and in the «In Range Script» – in step 2.

We can only test the system in action – just disable Bluetooth on your phone and then turn it on again. The computer should lock and unlock.

Thats All!

The end-link: essay .

Incoming search terms: app that locks your iPhone from imac , app to lock mac book from iphone? , how to lock a macbook pro from your iphoen , how to lock mac from iphone , how to lock macbook from iphone , lock mac with iphone ,
This entry was posted in How-To`s and tagged , , , , , . Bookmark the permalink .

Leave a Reply