How to schedule iMessages on Mac

First, open Terminal on your Mac, then follow these steps to copy and paste the following command lines:

Send iMessage by Shell

1
2
3
4
file="$HOME/Documents/sendiMessage.sh"
str='tell application "Messages" to send "TEXT" to buddy "NAME"'
echo "#!/bin/zsh \nosascript -e '$str'" > $file
open $file

You will see a file opened by the default TextEdit application that displays:

1
2
#/bin/zsh
osascript -e 'tell application "Messages" to send "TEXT" to buddy "NAME"'

Please note that you should replace TEXT with the text you want to send in the Contacts app, and replace NAME with the name.
Don’t forget to save the file.

Crontab on Mac

1
sudo touch /etc/crontab

You should run the above line, as com.vix.cron checks whether /etc/crontab exists on macOS.
Enter your Mac’s password.

Schedule the shell with Crontab

1
00 10 25 3 * zsh ~/Documents/sendiMessage.sh

As the Crontab – Quick Reference shows:

1
2
3
4
5
6
7
8
00    10    *   *    *        command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

This shell means that your Mac will send an iMessage at 10:00 on March 25th.

Then modify it to your desired time.

1
crontab -e

In the following steps, you are using vim, which I find to be the hardest part.

  1. Press i, you will see --INSERT-- in the bottom left corner of Terminal.
  2. Paste 00 10 25 3 * zsh ~/Documents/sendiMessage.sh
  3. Press shift + :, then enter wq, and press enter

Check Crontab

crontab -l

You can see 00 10 25 3 * zsh ~/Documents/sendiMessage.sh if everything is correct.

Translated by gpt-3.5-turbo