Change the Terminal Message of the Day in Mac OS X

Whenever you launch the Terminal in Mac OS X, you may get a little message: “Welcome to Darwin!” or a “Last Login” time – well, after you’ve seen it a few hundred times you might be sick of it, or perhaps you’d prefer something more amusing, meaningful, or even useful to yourself and other computer users. That little message you’re seeing is the MOTD, otherwise called a Message of the Day, and it’s a simple text file located at /etc/motd.

We will show you how to change the MOTD in the Mac OS X Terminal to whatever you want, easily.

Checking the Current MOTD

Launch the Terminal and type:

$ cat /etc/motd

Unless you have already customized it, “Welcome to Darwin!” or the “Last Login” message will be what appears, depending on your version of OS X. Another option is if the /etc/motd file does not exist (which for many modern versions of OS X is the default case now), then nothing would appear except for the login details. But we don’t want that anymore, we want our very own motd message when a new terminal is launched, so here’s how to turn it into whatever you want.

How to Modify the Message of the Day (MOTD) to a Custom Message

Type the following into the command line, this will open the motd into nano, if you want to use another text editor like vim, that’s OK too:

sudo nano /etc/motd

nano is nothing more than a command line text editor, and works just like one. Line over and delete the text and type whatever you want in its place.

Let’s say we’ll place the message “Hello from OSXDaily.com!”

To save the changed MOTD file, you’ll hit control-O, and then hit return. That’s it. Then hit Control+X to exit out of nano editor.

Now when you launch the Terminal you’ll be greeted with your new message, in this case it may look like the following:

Hello from OSXDaily.com!
Mac~$

You can also choose to redirect output of a command to the motd file, including bash scripts or an existing command. For example, you could output uname or sw_vers like so:

sw_vers > /etc/motd

That would make the MOTD in OS X tell you the name, version, and build upon login, like so:

Note: Some users will be required to run nano as root, depending on their account privileges or what they’re logged into, this is done via the sudo command. Using the sudo command will prompt you for the administrators password. The appropriate sudo prefixed syntax would be:

$ sudo nano /etc/motd

The rest of the modification is the same.

If you want to remove the customized motd, just delete it from the /etc/motd file, or create a ‘.hushlogin’ file in the users root directory.

Related

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

ok. i customized the motd, it worked fine. but then i used “touch .hushlogin” to remove the “Last Login…” info from showing up every time i start Terminal. It worked in removing the “Last Login…” info, but it also has stopped my motd from displaying. any help in undoing hushlogin would be greatly appreciated. i just want the motd to come back upon launch.

Too late for sully, but here’s how to undo “touch .hushlogin” to get back the “Last login”
line at the start of each terminal session.

If you used “touch .hushlogin” command to remove the “Last login…” info, which shows up at each login to terminal, you can restore the “Last login” info by deleting the invisible .hushlogin file, located in your home folder.

One way to do this is to open terminal and type “rm ~/.hushlogin” (without the quotes, of course!) $ rm ~/.hushlogin

I tried this to get rid of a persistent Terminal message… and so following this tip did actually work and added my text line, BUT I still have this lingering line of text “You have mail.” in any new Terminal window… Any one know how to get rid of it or why its there… :-(

Make a c++ unix executable to launch on start up:
nano zebra.cpp
#include
using namespace std;
int main(){
system(“cp ~/motd /etc/motd”);//enable root user
return 0;
}
^x
c++ zebra.cpp -o zebra
nano motd
The common zebra is an African equid best known for its beautiful, luxurious and
distinctive black and white stripes. Its stripes come in different patterns
unique to each individual, much like a snowflake. It is generally a pleasant and
social creature that lives in small harems to large herds. Unlike its closest
relatives, the horse and the ass, the zebra has never truly been domesticated.
^x

Last login: Tue Mar 29 08:45:38 on ttys005
The common zebra is an African equid best known for its beautiful, luxurious and
distinctive black and white stripes. Its stripes come in different patterns
unique to each individual, much like a snowflake. It is generally a pleasant and
social creature that lives in small harems to large herds. Unlike its closest
relatives, the horse and the ass, the zebra has never truly been domesticated.