Change the Mac OS X Terminal’s Message of the Day

Jan 30, 2007 - 18 Comments

Whenever you launch the Terminal in Mac OS X, you get a little message: “Welcome to Darwin!” – well, after you’ve seen it a few hundred times you might be sick of it, or perhaps you’d prefer something more useful to yourself and other computer users. There is no rocket science with this at all, its called a Message of the Day and it’s a simple text file located at /etc/motd. We will show you how to change it to whatever you want, easily.


Launch the Terminal and type:
$ cat /etc/motd
Unless you have already customized it, “Welcome to Darwin!” will be what appears. But we don’t want that anymore, so here’s how to turn it into whatever you want.

Type the following:
$ 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.

To save you’ll hit control-O, and then hit return. That’s it. Now when you launch the Terminal you’ll be greeted with your new message.
Hello from OS X Daily!
Mac~$

Note: It has come to our attention that some users will be required to run nano as root, via the sudo command. Using the sudo command will prompt you for the administrators password. The new syntax would be: $ sudo nano /etc/motd

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:

Related articles:

Posted by: OSXDaily in Command Line, Mac OS X

18 Comments

» Comments RSS Feed

  1. anon says:

    another great tip!

  2. Denver says:

    Hah…it’s great…i changed it to “don’t terminate my terminal”….

  3. Mario says:

    It didn’t work for me. I get the message “Could not open file for writing: Permission denied”. Do I have to be logged in as root? I have admin privileges with my regular login.

  4. IvanTheTerrible says:

    Mario,

    I don’t think you’re alone. Try adding the ‘sudo’ command to the sequence in front of nano. This would make the new command be:

    sudo nano /etc/motd

    It will prompt you for the administrator password, which allows you to edit the file by running nano as root. Hope that helps you and others.

    Also, you can quit nano by hitting control-X

  5. Mario says:

    Thanks, Ivan. I suspected I needed to type sudo before the command, but I wasn’t sure.

  6. vlad says:

    is there a way to get rid of the “last login” message as well?

  7. Joel says:

    hi, could any one tell me What “Sudo nano” means?
    Thanks

  8. Tipster says:

    Joel,

    ‘sudo nano’ is a command that runs the nano text editor as the super user root (or system administrator), thus allowing you to edit the /etc/motd file

  9. Yes says:

    In case anyone is still wondering, this how to get rid of the “Last login:” message. Run `touch .hushlogin` in your home folder.

  10. sully says:

    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.

  11. josh Fuller says:

    ~/.hushlogin actually prevents the system from displaying /etc/motd during your logins. You can still put your own login customizations into ~/.profile if you wish, for example…

    $ sudo vi ~/.profile

    Edit this like a regular bash script and use echo to display what you wanted in your motd.

  12. Mark says:

    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

  13. [...] you want to, you can create a custom MOTD with whatever message you want that will be displayed [...]

  14. MOKA says:

    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… :-(

    Thnx
    MOKA

  15. fpond says:

    After rebooting the old message reappears. Any ideas?

    • Dagan says:

      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

      Then go to system preferences and make it run on start up.

      It better be about f***ing zebras.

  16. Dagan says:

    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.

    SAMsDesktop:~ PsuedoDagan$ echo yes.
    yes.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates