4 Easy Ways to Automate Your Mac’s Schedule

4 Easy Ways to Automate Your Mac’s Schedule

Tutorial Details
  • Topics: Automation, Scheduling
  • Difficulty: Intermediate
  • Estimated Completion Time: 20 Minutes

Your Mac comes with lots of ways to schedule tasks, but not all of it’s ready to go out of the box. Beyond automated maintenance, OS X has a lot going for it, but you have to put in a bit of elbow grease to get everything working how you want it and on your schedule. In this tutorial we’ll look at four ways you can automate and personalize your Mac’s schedule in OS X.


We’ll take a whack at a dead simple third party app, play around in System Preferences a bit, and try out a couple of scheduled workflows in Automator. Hit the jump to follow along.


1: Startup & Shutdown

This is one of the easiest automations on the Mac, and it’s native to OS X. Beyond convincing your roommate that your MacBook Pro was built on an ancient burial ground and ghosts are shutting it on and off, there are some pretty good reasons to have your Mac take care of these functions itself. Your Mac can boot up to perform routine maintenance while you’re asleep or at work, or shut itself off to save power when you’ve fallen asleep watching a movie. It can startup first thing in the morning to save you a step and a minute or two in the course of your day.

Your Mac can boot up to perform routine maintenance while you’re asleep or at work.

Here’s how you do it. Open System Preferences, either from Utilities in Applications or by clicking the Apple Menu. Choose Energy Saver and click Schedule…

Scheduling Shutdown and Startup in System Prefs
Scheduling Shutdown and Startup in System Prefs

You can choose to startup/wake your Mac at a set time on a specific day of the week, just weekends, weekdays, or everyday. The second checkbox allows you to apply the same choices to when you want your Mac to sleep, restart, or shutdown, but you can only choose one of those three actions.

It’s important to note that if you have a MacBook Pro or MacBook Air, this tip will only work if your Mac is plugged into a power source. If you fall asleep with your Mac unplugged or your cat has a tendency to use your adapter plug for batting practice at night, your Mac won’t startup as advertised.


2: Regular Maintenance

Once your Mac is moving around at 2 AM while you’re sleeping, raiding the fridge or making calls on Skype, you can get it doing something really useful, such as the routine maintenance OS X is supposed to do in the middle of the night. This one is a particular sticking point for me, because while my MacBook Pro is “always on,” when I’m not using it, it’s closed and asleep for fear that my cats will walk across the keyboard when I’m not looking and accidentally-on-purpose order all of Etsy.

Cocktail is a great app for scheduling those maintenance tasks that will keep your Mac humming like a drowsy bee.

Cocktail is a great app for scheduling those maintenance tasks that will keep your Mac humming like a drowsy bee. Once downloaded and installed, you’ll have to enter an administrator’s password to get it open, because Cocktail just does that much next level stuff.

Click the Pilot tab all the way to the right, and choose Scheduler. Select which scripts you’d like Cocktail to run for you, Daily, Weekly, or Monthly. Those are just the built-in Mac OS X maintenance scripts, but Cocktail also gives you a few more options when setting up automation.

Cocktail can run lots of Mac maintenance tasks on a schedule.
Cocktail can run lots of Mac maintenance tasks on a schedule.

Cocktail will clear selected caches, for either the user logged in or all users. Clicking Options gives you a lot more control over what happens when Cocktail takes a shiv to your various caches, and you can get really specific with your component, user, and Internet caches, letting Cocktail know exactly what’s good to keep and what gets the axe. You can also have Cocktail delete language files you’re not using, or tell Cocktail what to do with your log files during maintenance.

Cocktail will play a completion sound, nice if you have it set to run while you’re cooking or organizing your CDs, less so half an hour before your alarm goes off, though, so use with care. You can also set up Cocktail to shut down, log out, or put your Mac to sleep once it’s finished.

The important thing, though, is scheduling. You can set Cocktail to run your maintenance tasks every day or on a specific day of the week, at any time you want. When combined with the automated startup we discussed in number 1, you’ll have your Mac performing its own planned tuneup when you know you won’t be using it anyway.


3: Prime Your Mac So It’s Ready to Go when You Login

Most people have used Login Items in the past, even if they haven’t realized it. If you’ve installed an app that pops up a menubar item every time you start up, like Dropbox, Cloudapp, or Caffeine, you’re using Login Items. More than that, Login Items are apps that launch whenever you log in. If there are applications you always have running (like Mail or another email app) or apps you want to be the first thing you see when you look at your Mac in the morning (like iCal or task management), Login Items will get these apps rolling automatically for you.

Login Items are apps that launch whenever you log in.

Depending on the applicationss involved, this could significantly slow your login, however, and the more apps you pile on, the more significant the drag. Handle with care, your mileage may vary, and similar cliches are appropriate here.

To access Login Items, get into System Preferences, click Users & Groups, and choose the Login Items pane. There you’ll see a list of every app that launches when you login.

Login Items lets you decide what OS X launches on login.
Login Items lets you decide what OS X launches on login.

Adding an app is pretty simple. If you want Mail to automatically launch, click the plus (+) sign under the list of apps and navigate to your Applications folder. Choose Mail, and click Add. Once added, if you want to hide the app on login, select the checkbox next to the app in the Login Items list.

If, like me, you’ve added pretty much all of your apps to your Login Items and you realize it’s taking an unreasonably long time for everything to load when you start your Mac up, it’s easy enough to remove the apps from Login Items that seemed like a good idea at the time but are just slowing things down. Just select the app you want to get rid of in the list and click the minus (-) sign. Poof! Gone.

For some ideas on what works in Login Items, email, calendars, and frequently used programs that you’ll turn to immediately are instant winners. I have my email app, a couple of cloud storage apps, Twitter, and a menubar Facebook updater in my Login Items, because those are the apps I’m either going to check right away or will want access to the entire time I’m using my Mac.


4: Schedule Everything Else with Automator and iCal

You can set your Mac up to do just about anything at anytime using Automator and iCal. Automator allows you to automate tasks without knowing anything about programming or scripting. Instead, Automator allows you to set up tasks as a series of actions inside a graphical user interface.

Automator will take care of all of the things we couldn’t do in the earlier steps, like running a specific application at a set time, not just at login. To get started, locate and open Automator in your Applications folder. If you’re not prompted to start a new document, Click New in the File menu, and then select iCal Alarm for your document type. An iCal Alarm allows you to choose whatever Automator actions you need and then schedule them using iCal.

On the left is the list of all the preset actions, and you can choose just one or a combination of several. I’ll run through a couple to give you an idea of what Automator can do with only minimal effort on your part.

First, we’ll set up an iTunes playlist as an alarm, not just an iCal event alarm, but something to wake you up in the morning or to remind you it’s time to exercise. In Automator, find the “Find iTunes Items” action, and drag it to the workflow area on the right. Now you’ll fiddle with some options. The default is to “find tracks where,” but select the “tracks” dropdown and choose “playlists.” Next, in the search field, enter the name of your iTunes playlist. You can run your workflow at this point using the buttons in the top right, but it won’t do much of anything except let you know that your Boyz II Men playlist was found.

Creating an iTunes playlist alarm workflow in Automator
Creating an iTunes playlist alarm workflow in Automator

Now that Automator can find Motown Philly, it has be able to play it somehow. Locate the “Play iTunes Playlist” action, and drag it to the workflow, beneath the Find action. Now you can run your workflow. iTunes will launch, and your general vicinity will be filled with lush hip-hop doo-wop. This is only half the Automator/iCal love story, but I’m going to pause to talk about how to automate more applications before we move on to scheduling.

If you want an application to open at a specific time, that’s even easier. Find “Launch Application” in the actions list, and drag it to the workflow. You can have as many instances of the “Launch Application” action as you’d like, but remember they’ll run in order.

In the Application drop-down, just choose which application you want to launch. You can schedule all the apps you use to work to pop up at 8:55 AM, so they’re ready for you when you sit down with your cup of Joe, or set your media center apps so they’re waiting for you at 7:25 PM.

Scheduling an Automator iCal alarm workflow
Scheduling an Automator iCal alarm workflow

Now that we’ve talked about a couple of the ways to set up workflows, you’re ready to schedule. You’ll save your workflow iCal Alarm, causing iCal to launch, and your workflow will appear as an event. Now all you have to do is edit it like any other iCal event. Change the time you’d like it to occur and the date, whether you’d like it to repeat–you probably will after all this trouble–and how often you’d like the alarm to go off.

Wrap Up

These are only a few examples of what you can do with these features. Each of the scheduling tools discussed above can be tailored to whatever you need from your Mac on a given day and is capable of so much more than just automated startup, shutdown, and app launching. Automator’s workflows in particluar are really endlessly customizable and, combined with the other scheduling tools in this tutorial, should keep you automating for days.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://kevinlorenz.com verpixelt

    Nice post done here. Youre talking about “Mac OS X maintenance scripts” in number two. Which are important scripts on your opinion? Which ones should run every week or so?

  • Damion Anderson

    Or you can use cron jobs, if you are terminal savvy

  • Rounik

    @verpixelt you can also use Onyx for Mac (free) to run a bunch of maintenance scripts. Very useful app. If you want to delve deeper there’s an excellent post by the late Richard Lainhart on running OS X Scripts in the Mac’s Terminal:
    http://www.macprovideo.com/hub/mac-osx/optimise-your-macs-performance-using-terminal-to-run-os-x-maintenance-scripts

  • http://pauladupont.com Paula DuPont
    Author

    I’m referring to the daily, weekly, and monthly maintenance scripts that OS X should be running around 3-5 AM but won’t run if your Mac is asleep or off. I think they’re all important to keep your Mac running speedily, especially since they’ll clear out some older log files that can get kind of cumbersome. I absolutely do not run them on the daily/weekly/monthly schedule, and usually just run them all at the same time since I’m there anyway. If you’re not running the daily scripts every 24 hours, you can run those when you remember to or as an add-on to your scheduled weekly scripts.

  • Carlos Faria

    Nice post :)
    I have one question: how can i automate my Mac to open especific programs in the morning, like suitcase fusion, msn and photoshop, to when i arrive this programs is already to work?

    tkx

    Sorry my english :( is very poor!

    Uma pergunta: como faço para automatizar meu Mac para abrir programas específicos pela manhã, para quando eu chegar ele já estar preparado para iniciar o trabalho. Programas como Suitcase Fusion, MSN e Photoshop. Como faço para que eles iniciem logo pela manhã?

    Obrigado

    • http://pauladupont.com Paula DuPont
      Author

      You can either set up your apps to open with Automator and iCal, or you can add them to your Login Items so they open when you start up your machine in the morning. :)

  • Mosheau

    Is it possible use your 1st automation tip (startup the computer), then the 4th (use automator & ical) to setup an alarm clock (which plays music on itunes or spotify)? I imagine it is, but I assume it would not work if there is a login password. Is there any way to bypass the password screen (without removing it completely)?

    Thanks for the great post!

  • Invincible Youth

    Hi Paula,

    Thank you for your awesome tut! I’ve purchased Cocktail license after a few days’ trial.

    However, here’s a problem. Seems that MacBook Pros automatically go to sleep whenever the lid is closed. (For your reference, I am running OS X 10.8.1 on 13” Mid-2012 MBP.) And Cocktail Scheduler need to “make sure that your computer is on and not in the sleep mode at the scheduled time”.

    How do you solve this problem? I’ve scheduled a wakeup in System Preferences, but I don’t know whether the machine actually wakes up if the lid is closed at the scheduled time. MBP can run with the lid closed if you scheduled that? And Cocktail will perform maintenance accordingly? (I heard that MBPs draw in air from the keyboard, and if the lid is closed, the fan can’t work efficiently…)

    It is possible to leave the lid open half an inch when I go to sleep, but it is rather annoying, you know what I mean ;)

    Hoping to hear your advice!

    Regards,
    Kevin

  • Guest

    Thank you for writing this article, got something new.

  • Guest

    Thank you for writing this article, got something new http://msidata.com/

  • coconutstudio

    This was a very helpful article. I’ve been using Automator and I can’t believe how useful it is.

  • Peter Fay

    I’ve used Automator and iCal to schedule when my computer shuts down for the night at a specific time. However, when I shut the computer down myself before its scheduled time and then turn it back on after its scheduled time, the shutdown workflow is activated, and five minutes later my computer shuts down again. Is there a way either in Automator or iCal that I can keep this from happening?