Top 4th of July Sales Best 4K Projectors 7 Early Prime Day Deals Wi-Fi Range Extenders My Favorite Summer Gadgets Cheap Car Insurance Target's 4th of July Sale Best Running Earbuds, Headphones

How to send a text message via command line in OS X

You can send text messages to anyone using Terminal.

OS X Daily recently outlined a new hint which allows you to send text messages to any SMS-supporting phone for free, from the OS X command line (or any OS with a command line supporting the "curl" command).

To do this, you use TextBelt, which is a Web-based SMS API that you can use to text messages using simple POST requests with the "curl" command. For example, to send a text message, you can run the following command:

curl -d number=4155551111 -d message="The Message Text"

In this example, the message "The Message Text" will be sent as an SMS message to the number (415) 555-1111. If the message is sent successfully, you will receive an output to the command line that reads {"success":true} and if not, then this message will read "false" followed by a brief explanation.

This service can be exceptionally useful, especially if you regularly run scripts on your system to perform backup, maintenance, and other tasks. You can embed this service to run conditionally in your script, so it can notify you if the script completed, or encountered an error, or otherwise ran in a specific way intended or unintended.

While there have been options to spur notifications in Apple's Notification Center from scripts and commands in the OS X Terminal, this is a local notification that will only be visible if you are sitting in front of your computer. Using the TextBelt API, you can have your script send a notice to your phone wherever you are.

Note that if you use this script, there are some limitations noted on the TextBelt Web site. First is they limit you to 75 texts per IP address per day, and only three texts can be sent every three minutes; however, if you require more than these you can make a special request to Ian Webster (creator of the API) to have an exception implemented. In addition, some cell carriers are not supported, but the following should work just fine:

Alltel, Ameritech, AT&T Wireless, Boost, CellularOne, Cingular, Sprint PCS, Telus Mobility, T-Mobile, Metro PCS, Nextel, O2, Orange, Qwest, Rogers Wireless, U.S. Cellular, Verizon, Virgin Mobile.

Finally, note that for some carriers, you may see the incoming message arrive from the address ""

Questions? Comments? Have a fix? Post them below or !
Be sure to check us out on Twitter and the CNET Mac forums.
The MacFixIt blog can be found directly at