Enabling Remote Apple Events in macOS

How I Use Tailwind CSS To Design A Website From Scratch

Enabling remote Apple events

Continuing our run down of the sharing preference pane we’ll cover remote Apple events, remote Apple events allow apps running on other Macs to send commands directly to the Mac with remote Apple events enabled these commands can include “opening an app”, “printing a document” or even playing music.

Basically, remote Apple events allow you to quickly run a task on another Mac without having to use screen sharing.

Go to:

System Preferences > Sharing

Check the Remote Apple events option:

Again, you should specify which users can use remote Apple events using Only these users option to be more specific:

You will need to know the I.P address of the Mac you have enabled remote Apple events on, you can go back to System Preferences > Network to find the local I.P address or if you want to run these events from outside your local network (home Wi-Fi etc) you will need to obtain your external I.P address from your router and enable port forwarding to your Mac.

For a simple outline of how to use Apple Script on another Mac to send commands to the Mac you have enabled remote Apple events on:

Firstly, open AppleScript Editor from Applications > Utilities > Script Editor.app

And for our first simple script we will simply tell iTunes to open and play on the remote machine.

setremotemachineto "eppc://192.168.2.3"

tellapplication"finder" ofmachineremotemachine

open("/applications/iTunes.app" asPOSIX fileasalias)

endtell

using terms fromapplication "iTunes"

tellapplication"iTunes" ofmachineremotemachine

setlocalVariabletoplayplaylistnamed "Rock"

endtell

endusing terms from

Set the I.P address to the machine you have enabled apple Remote events on:

setremotemachine to "eppc://YOUR I.P ADDRESS"

You will also need to change the playlist name from rock to one of your playlists:

setlocalVariabletoplayplaylistnamed "Insert your playlist name”

Alternatively change the command to just play and iTunes will open and play on the remote machine:

setlocalVariabletoplay

Now when you hit run in the Apple Script editor:

When you first run the script, it will ask you to enter the username and password for the remote machine:

The remote machine will open iTunes and play the playlist called Rock.

This Apple Script we have custom coded for this tutorial, if you want to learn more go to the Apple Script website Mac OS X Automation.

And for more iTunes commands including building a remote player see the Apple website.

Subscribe to my newsletter

Join me on my journey as I set out to help aspiring entrepreneurs take that critical first step.