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
    Welcome to My New Office

    My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...

  • By
    Write Better JavaScript with Promises

    You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...

Incredible Demos

  • By
    pointer Media Query

    As more devices emerge and differences in device interaction are implemented, the more important good CSS code will become.  In order to write good CSS, we need some indicator about device capabilities.  We've used CSS media queries thus far, with checks for max-width and pixel ratios.

  • By
    Implement jQuery’s hover() Method in MooTools

    jQuery offers a quick event shortcut method called hover that accepts two functions that represent mouseover and mouseout actions. Here's how to implement that for MooTools Elements. The MooTools JavaScript We implement hover() which accepts to functions; one will be called on mouseenter and the other...

Discussion

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