How to Turn on Mac Focus Mode from the Terminal

Learn how to turn macOS Focus Mode on and off from the Terminal using Shortcuts.

Focus Mode is a helpful macOS feature that lets you enable Do Not Disturb, block notifications, and enable other productivity-enhancing features.

Turning it on and off is easy, it can be enabled from the menubar Control Center or in System Preferences.

But what if you want to turn Focus Mode on or off programmatically? Like from another app, or integrate it into your workflow?

Keep reading to learn how to turn Focus Mode on and off from your terminal, or any other application that supports scripting.

Turn on Focus Mode with Shortcuts

The key to being able to easily turn Focus Mode on and off in the Terminal is by creating a Shortcut.

  • To get started open /Applications/Shortcuts.app

Shortcuts let you setup automations on your Mac you can run from anywhere.

Shortcuts let you setup automations on your Mac you can run from anywhere.

  • Click the + (New Shortcut) button in the toolbar.
  • Type focus into the search box
  • Double-click Set Focus to add it to your shortcut
  • Click Do Not Disturb and select the Focus Mode you want to enable, like Work
  • Also, ensure its set to turn On until Turned Off

Create a Set Focus shortcut that lets you enable Focus Mode from anywhere, including Focus App.

Create a Set Focus shortcut that lets you enable Focus Mode from anywhere, including Focus App.

  • Close the window, and you're ready to use your shortcut, by default, its called Set Focus

  • Test your shortcut works by clicking the play icon in the top right corner of its box. Focus Mode should be enabled with the profile you specified.

With that setup, you're reading to start programmatically enabling and disabling Focus Mode!

Turn on Focus Mode from the Terminal

Your Mac can run any shortcut from the terminal, which is incredibly powerful.

Using the Set Focus shortcut we just set up, we can call it from the Terminal with the shortcuts command, like this:

shortcuts run "Set Focus"

That's it! If you changed the shortcut name, be sure to use that instead.

Now you can enable Focus Mode programmatically from the Terminal.

Turn on Focus Mode from other apps

Now that we have the ability to run Focus Mode from the Terminal, we can also integrate it to any other application that enables scripting, like Focus.

Focus is a Mac app that helps you block distractions so you can accomplish your best work. It's a lot more powerful than Focus Mode from Apple. It has powerful website blocking and can handle nearly any productivity workflow you throw at it.

To enable Focus Mode from Apple when Focus runs, add a Focus Script and add the command you used above:

Focus enables scripting, including the ability to run shortcuts and automatically turn on/off Focus Mode.

Focus enables scripting, including the ability to run shortcuts and automatically turn on/off Focus Mode.

Now when you turn Focus on (with 1-click, or set it up on a schedule), Focus Mode will automatically be enabled as well!

Having a hard time staying on task because of distractions? Focus is an app for your Mac computer that helps you stay on track. It blocks things that can distract you so you can get your work done. Try Focus and see how much better you can do!
Download Focus
← Back to blog
Focus Productivity on August 10, 2023