How To Remotely Control Your Mac Using Simple AppleScripts

Ads by Google

mac remote control scriptsIf you’re lucky to have two or more Macs in your home or office, you no doubt find occasions where you would like to remote control a Mac either from another room or from another part of the country. You probably know that you can use the Shared feature to remotely control another Mac on the same network. But by creating some simple AppleScript commands you can control a remote Mac much faster, alleviating the need to open the Shared screen feature.

If you have never worked with AppleScript before, don’t fret. The following Mac remote control scripts are very short and easy to use.

Settings For Remote Control

In order to remotely control a Mac, say your desktop machine, you must first set it up for commands to be sent to it. To do this, launch System Preferences > Sharing on the Mac you want to control. Click the box next to Remote Apple Events, and set user restrictions if you need to.

mac remote control software

Next, you will need the IP address. In System Preferences, switch to Network and locate your machine’s IP address. It should be something like, 192.168.2.3.4.. Copy that address to proceed to the next step. You can also use the machine’s Bonjour name which can be found at the top of the Sharing pane in System Preferences. Its address will be spelled similar to this one: “smith-nancy-computer.local.”

Create A Script Command

Now, on another Mac, say your laptop, launch the AppleScript Editor, which can be found in Applications Folder > Utilities Folder. Our first command will be one that puts the remote Mac to sleep.

Ads by Google

In AppleScript, go to File > New. Copy and paste the following simple script in the editor:

tell application “Finder” of machine “eppc://192.163.1.2.3″
sleep
end tell

Replace the sample IP address with the address of the Mac you’re going to send the command to. Be sure the address comes after “eppc://.

remote control mac

Now click the Compile icon. If you don’t get an error message, you should be good to go.

remote control applescript

Now make sure the remote is awake and running. Click the Run button in AppleScript. You will probably be asked for authentication. Type the username and password of the Mac you’re sending the command to. If it works, then you have successfully sent your first remote command to another Mac.

Saving Your Scripts

There are a couple of ways you can save and access your scripts. You can save them to the Scripts Menu that can be put into the menu bar of your desktop. It looks like this:

remote control applescript

If it is not there, go to the AppleScript Editor, open its Preferences and click the box, “Show Script menu in menu bar” in the General Pane. If that doesn’t bring it up, look for the AppleScript’s folder in the Applications folder. Inside that folder, find and click on “Install Script Menu.”

remote control applescript

Save your script in your Home Library > Scripts folder. It then should show up in you Scripts Menu. From there, you can run the script whenever you need it without having the AppleScript Editor open.

mac remote control software

If you think you’re going to run the script on a regular basis, you can save it as an application and put it in your Dock.

Other Command Scripts

Here are a few other commands that you might want to send to your Mac.

Start iTunes

tell application “iTunes” of machine “eppc://IP Address”
play
end tell

Stop iTunes

tell application “iTunes” of machine “eppc://IP Address”
stop
end tell

Increase Volume

tell application “Finder” of machine “eppc://IP Address”
set volume 7 — Call this one “Full Volume”
end tell

Open The Safari Browser

tell application “Safari” of machine “eppc://IP Address”
activate
end tell

Close The Safari Browser

tell application “Safari” of machine “eppc://IP Address”
quit
end tell

Let me know if this tutorial works out for you. If you know of other AppleScript commands that our readers might find useful, please share them here. For some more AppleScript automation ideas, check out this article, and if you looking for Mac automation tips, download my free MUO Guide to Mac Automation.

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Mac Troubleshooting
Mac Troubleshooting
6 Members
Apple Hardware Discussion
Apple Hardware Discussion
9 Members
Apple News & Rumors
Apple News & Rumors
9 Members
Apple TV Tips & Hacks
Apple TV Tips & Hacks
6 Members
Mac Switchers
Mac Switchers
7 Members
Mac OS X & Software
Mac OS X & Software
6 Members
Mac Gamers
Mac Gamers
5 Members
Ads by Google
Comments (8)
  • Sascha

    I wonder that nobody sees that the demo IP adresses are wrong. They are no IP adresses with 5 numerics like 192.168.1.2.3, instead 192.168.0.1 … is valid. Please correct.

    • Bakari Chavanu

      “Replace the sample IP address with the address of the Mac you’re going to send the command to. Be sure the address comes after “eppc://.”

  • Jeroenvdwel

    How can I activate a script on my mac though my iPhone SpringBoard?

    Maybe a link that triggers a Folder Actions, but how!!??

    • Bakari

      Jeroenvdwel, I would have to check into that. I don’t use SpringBoard. I use a paid app called Quickeys to activate automations from my iPhone and iPad. I do know that Hazel, also a paid app, is great for folder actions. When a file is dropped into a designated folder (the file could be sent say to a Dropbox folder), Hazel will run a set of rules you apply to it.

  • Jeroenvdwel

    How can I activate a script on my mac though my iPhone SpringBoard?

    Maybe a link that triggers a Folder Actions, but how!!??

  • Nathan Henrie

    Even more helpful (for me) has been using Goodreader + Dropbox + Applescript to run scripts from my iPhone. Just use “Folder Actions” (or Hazel) to monitor a folder, using a “if filename matches” cue, and keep a folder of empty .txt files (with appropriate names) sync’d to Goodreader. Upload the files from Goodreader to your monitored Dropbox folder, which will run the script from anywhere.

    Make sure to end the script or Hazel action with a “move file to trash” after the applescript is executed.

    • Bakari

      Great tip. I got all kinds of Hazel workflows. Wish it were a free application, so i could write about it more on MUO.

  • Nathan Henrie

    Even more helpful (for me) has been using Goodreader + Dropbox + Applescript to run scripts from my iPhone. Just use “Folder Actions” (or Hazel) to monitor a folder, using a “if filename matches” cue, and keep a folder of empty .txt files (with appropriate names) sync’d to Goodreader. Upload the files from Goodreader to your monitored Dropbox folder, which will run the script from anywhere.

    Make sure to end the script or Hazel action with a “move file to trash” after the applescript is executed.

Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.