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 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).

Preferences

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.

Before You Go...

Just wanted to let you know that we've just launched our YouTube Channel where we'll upload awesome video content. Make sure you hit the subscribe button to stay up to date with the new videos we upload every week.

Get Guiding Tech articles delivered to your inbox.

Also get a free ebook when you subscribe.

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



  • James

    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?

    • http://www.guidingtech.com/ Alvaro Bernedo

      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

        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.

  • Samwise

    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!?

  • http://twitter.com/NoHopsWhiteGuy Jordan Maher

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

  • raveur

    Doesn’t work. It’s abandonware

  • Dan

    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
    try
    tell application “System Events”
    keystroke “a” & return
    end tell
    end try
    sleep 4
    try
    tell application “System Events”
    keystroke “yourpassword” & return
    end tell
    end try
    stop ss
    end tell