How to Instantly Lock and Unlock Your Mac With Your iPhone’s Bluetooth Signal

Ads by Google

Locking Your MacHave you ever wished you could just walk away from your Mac and have it lock itself without you doing anything? Or perhaps sometimes you leave your desk and completely forget to lock your Mac? This can be a very delicate situation, since we all have an enormous quantity of sensitive information in our Macs and it can be downright fatal to lose them.

Well, here is a nifty trick that will allow you to use your iPhone’s Bluetooth signal to lock your Mac when you walk away and to wake it up when you return.

Important Note: This process only works for Macs running a version of Mountain Lion

Follow the steps below.

Step 1: Download Proximity, a Mac application that runs scripts upon detection of Bluetooth devices. You can get it from this link. Then, download two Apple scripts that I created for this app. Use this link (UPDATE: This file is not available anymore) to get them in one zip file. Once you do, unzip the scripts and save them anywhere on your Mac, just remember where.

Proximity for Mac

Mac Lock Scripts Zip File

Step 2: On your Mac, open the Proximity app that you just downloaded and it will install an icon in your menu bar. Click on its icon then click on Preferences.

Proximity Preferences

Step 3: Make sure to at least check the Enable device monitoring option and then choose the interval at which you would like your Mac to scan and verify that your iPhone’s Bluetooth is in range (anything between 5 – 10 seconds works for me).


Ads by Google

Step 4: Enable Bluetooth on your iPhone. To do so, on your iPhone go to Settings > Bluetooth and turn it ON. Don’t forget to pair your iPhone to your Mac if you haven’t done so in the past.

IPhone Settings  IPhone Bluetooth ON

Step 5: Add the Apple scripts you downloaded to the Proximity app. On its Preference Pane under AppleScripts click on the Change button beside Out of Range Script. Find the script named Lock Mac from where you placed it and choose it. Do the same for the In Range Script, only this time choose the Unlock Mac script instead.

Preferences Add Scripts

This is how it looks after I added the scripts.

Preferences Scripts Added

Step 6: On the same Proximity’s Preference Pane, click on the Check Connectivity button until your iPhone’s Bluetooth is detected.

Choose Bluetooth

IPhone Detected

Note: If your iPhone is not detected, click on Change Device and select it from the list of available devices

Step 7: Close the Preferences Pane and take your iPhone out of range. Your Mac will lock itself and will wake up the moment you (with your iPhone) come back in range.

That’s it! This is really a pretty nice trick. You can also enable it by simply turning your iPhone’s Bluetooth ON and OFF manually and even have fun playing tricks on your friends, who will not know what is turning your Mac on and off.

Get Guiding Tech articles delivered to your inbox.

We will never share your address. Unsubscribe at any time.

Post a Comment or Discuss at Guiding Tech Forums

Show archived comments (8)

Archived Comments

  1. James says:

    The screen doesn’t “lock” it only turns on screen saver. Is there a way to make it really lock, requiring a password that can be embedded in the unlock mac script?

    • Hi James,

      To lock the screen whenever the screensaver activates, on your Mac go to Preferences > Security & Privacy > General and then check the box next to “Require password (Immediately) after sleep or screensaver begins”.

      There you go :)

      • John Marich says:

        I can’t seem to get my Mac to unlock, though. As James asked, how do you embedded the password into the script so it unlocks. I could just disable my password but I don’t like that option.

  2. Samwise says:

    im having trouble on the return. the mac doesnt know my password and so doesnt come back from screen saver unless i enter my password manually!?

  3. Jordan Maher says:

    Nice trick! However my computer says device not found even though my iphone has its BT on.

  4. raveur says:

    Doesn’t work. It’s abandonware

  5. Dan says:

    Would be something like this, but troubleshooting here……..doesn’t seem to want to sleep for a few seconds and enters the password in too quickly. Have to open the Unlock Mac script with OS X built in Script Editor in the /Applications/Utilities folder and add the following. But work in progress……

    tell application “System Events”
    set ss to screen saver “Random”
    sleep 2
    tell application “System Events”
    keystroke “a” & return
    end tell
    end try
    sleep 4
    tell application “System Events”
    keystroke “yourpassword” & return
    end tell
    end try
    stop ss
    end tell

  6. Cloudy says:

    by any chance you have the scripts still? as the link seems to be broken now.