How to Send an iMessage From Command Line

By  on  

As somewhat of a recluse, believe me when I say that text messages, instant messenger, and iMessage have relieved me of loads of anxiety and wasted time with short, meaningless voice chat. It's been a decade since these communication types have become popular so we've moved on from appreciate these technologies to trying to optimize them.

My family and friends are deep into the Apple ecosystem so I frequently receive texts via iMessage (or Message on Mac); at the same time, I'm within a Mac terminal much of my day,. At this point, it's a bit of a hardship (poor me!) to even open the Messages app, and I'd prefer to send messages via command line.

To send a message via command line, you can type the following:

osascript -e 'tell application "Messages" to send "DWB and MooTools FTW!" to buddy "David Walsh"'

I'd recommend creating an alias for this command, which would accept a user and a message.

Command line wins are amazing time savers. Finding a way to accomplish tasks with your usual workflow will make you infinitely more efficient!

Recent Features

  • By
    I’m an Impostor

    This is the hardest thing I've ever had to write, much less admit to myself.  I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life.  All of those feelings were very...

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

Incredible Demos

  • By
    Optimize Your Links For Print Using CSS — Show The URL

    When moving around from page to page in your trusty browser, you get the benefit of hovering over links and viewing the link's target URL in the status bar. When it comes to page printouts, however, this obviously isn't an option. Most website printouts...

  • By
    MooTools 1.2 Tooltips: Customize Your Tips

    I've never met a person that is "ehhhh" about XHTML/javascript tooltips; people seem to love them or hate them. I'm on the love side of things. Tooltips give you a bit more information about something than just the element itself (usually...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!