Mac OS X Message of the Day


What is the Message of the Day

Every Linux distribution is unique. One way that they are unique is the shell, and even the message of the day displayed when you login to terminal. Ubuntu 11.10 and higher uses landscape if you are on their server build, OS X shows you the last time you logged in. Some platforms will display a random motivation quote or even show you an ASCII art funny.

By nature, I am CLI driven. I don’t mind using a graphical user interface, but I much prefer working through a terminal window. It is much quicker to type than to drag a mouse, and if you are familiar with scripting, I’m sure you agree.

I went ahead and created a PHP script for OS X Mountain Lion (but it does work on 10.6 and up) that will grab some key variables from the system_profiler command, and assign them to a variable.

Note: I use a mid-2012 Mac Book Pro with Retina, so when you look at the network interfaces, mine may not match yours.

What does my Message of the Day look like?

Here is a screenshot of what my new message of the day looks like:

Message of the Day

I’ve broken it down into different categories:

  • Networking
  • System
  • Battery

There are many options and variables available, such as hard drive space, NIC packets in/packets out, your current display brightness, and more.


Installation instructions and the source code is available on GitHub: mikemackintosh/HackintoshOSX-MOTD

Essentially, this is a PHP script, which executes the system_profiler command. This command will return output that looks similiar to the below:

The PHP script will the loop through the output and create a variable for each item. You can view a list of the supported variables on the GitHub page as well. It then creates an output similar to a bash script which is received via a pipe. It supports terminal colors for your pleasure.

Note: This script is not optimized, but does the job fairly quickly.

Leave a Reply