Skip to content

Pomodoro technique with CLI on macOS

Published:

2 min read

I often turn to the Pomodoro Technique when I’m overwhelmed by my to-do list. This method involves working for a set period (X minutes), followed by a short break (Y minutes), promoting focused sessions.

After trying various apps that lacked the simplicity I desired, I discovered a straightforward command line tool.

Prerequisites

Before diving into the specifics, here is what you will need:

Using timer

The timer command accepts a duration argument with a unit specifier (s for seconds, m for minutes, h for hours, and so on). For example, to set a timer for 30 seconds:

timer 30s

Executing the timer command with a duration of 30 seconds.

You can also add a description to your timer using the -n flag:

timer 30s -n "Some task"

Notification using tput bel

tput is a versatile command that allows shell scripts to perform things such as clear the screen, underline the text, or ring a bell (beep).

You can combine it with timer to get an alert when your session ends.

timer 30s -n "Short break" && tput bel

If your terminal window is in the background and alerts are enabled, you will receive a notification as shown below:

A notification is sent by tput command after the timer is complete.

Conclusion

This setup offers a minimalistic approach to a commonly used technique to manage your focus sessions.

I'm a software developer and a technical writer. On this blog, I write about my learnings in software development and technical writing.

Currently, working as a documentation lead at Expo.