Send iMessage to a loved one from the terminal!
mkdir ~/bin
Now let's go to it:
cd ~/bin
and create a file text.sh
#!/bin/bash
MESSAGE=$1
# Replace with their number (be sure to include the +1)
PHONE_NUMBER=+11234567
if [ "$#" -ne 1 ]; then
echo "Usage: $0 MESSAGE"
exit 1
fi
osascript -e "tell application \"Messages\" to send \"$MESSAGE\" to buddy \" $PHONE_NUMBER\""
Now we need to make the file executable:
chmod +x text.sh
Now we can use it!
./text.sh "I LOVE YOU"
Alias
To alias it so that you could say something like rach "I LOVE YOU"
Add to your .zshrc
or .bashrc
the following:
# local bin
export PATH="$HOME/bin:$PATH"
alias rach='text.sh'
Now we can say rach "I LOVE YOU"
and it sends!