Secure your Mac’s infrared port against random Apple Remotes

If you have a MacBook with an infrared receiver, did you know your Mac could be open to other people controlling your computer?  By default, Mac OS will recognize the signal of any Apple Remote.  Although the effect is relatively harmless (they will probably be able to randomly play some tracks on iTunes), it can range from being annoying if you were studying in the library and your friend happened to prank you, to embarrassing if you happened to be doing a presentation.

Most people do not need to allow any Apple Remote to control their computer.  Why would you want other people’s Apple Remotes to control your computer?  Here is a tutorial for securing your infrared port so that only your own Apple Remote can control your computer.

If you have an Apple Remote…

The icon showing a paired Apple Remote.
The icon showing a paired Apple Remote.

You can pair your remote with your computer by pressing and holding the Menu and Next (right) buttons for several seconds, while pointing the remote to the infrared receiver (on the MacBook Pro unibody models, the port is beside the power/sleep light on the front edge of the computer).  The pairing logo will show up in the middle of your screen when the pairing is complete.

If you don’t have an Apple Remote…

You can disable the infrared port so that nobody with a random Remote can control your computer.

  1. Open System Preferences → Security & Privacy.
  2. If the preferences are locked, you will need to click on the lock at the bottom left and enter your password.
  3. Click the Advanced… button at the bottom right.
  4. Check “Disable remote control infrared receiver.”
Security & Privacy - Advanced Options
The advanced options of the Security & Privacy system preferences panel.

Hopefully this tutorial will help you avoid annoying or embarrassing situations when people try to prank you with their own Apple Remote.

Featured image by Julien Gong Min on Flickr.

App Remote – Unleashing the Apple Remote

I’ve been using Sofa Control for my Apple Remote since I bought my Mac in 2009.  I use Sofa Control pretty much every week when I volunteer with the youth ministry at my church.  The Apple Remote by itself only works with certain programs that are designed to handle its input and it lacked support for other programs we were using such as OpenSong, which we use for song lyrics.  So I bought a license for Sofa Control.

Recently Sofa Control’s move to the App Store required all existing customers to repurchase the license.  I didn’t want to shell out another $20 for this small utility (as great as it has been, a total of $40 for this utility is a little pricy, considering the latest OS X Mountain Lion upgrade only cost $20), so I decided to see if I could program one myself.

I liked the feature that the application-specific handles were scripted.  I also liked how it was small and tucked away as a menu bar extra.  I definitely wanted to keep these features in my own version.

Yesterday (Labour Day, a statutory holiday) was the perfect day to work on this project.  I started off looking for some APIs to hook into the Apple Remote events.  Quite quickly, I found an Apple Remote wrapper written by Martin Kahr, the developer who created Sofa Control.  (Actually I lied; I looked for Apple Remote libraries weeks ago to determine the feasibility of the project, but I did have to find them again yesterday).

Then I looked for an easy scripting language to embed to receive the events generated from the Apple Remote.  I decided to go with AppleScript, the Mac OS built-in scripting language for two reasons.  First, AppleScript already has hooks to script actions in various applications.  Second, Cocoa already has classes to handle execution of AppleScript.

With two-thirds of my application already complete, I only needed to write a small delegate to receive events from the Apple Remote, and call the appropriate AppleScript.

About 200 lines later, I had a working prototype.  Honestly, there isn’t really much to show in terms of screenshots…

The source code and other technical stuff can be found on my GitHub account.  The binary can also be downloaded from Github (beware currently there isn’t much help or instruction with the package).

So with that, I conclude yesterday was a productive Labour Day 🙂