Quite frequently I have to send the outputs of my work on terminal (e.g. when compiling code) to my colleagues via email. I was wondering if it is possible to pipe (|) the output of a terminal command directly to email and I realized there are mail and mailx that can be used for this purpose.

The problem is, when I try a simple message like this

ls -laF | mailx -s 'generated files' [email protected]

nothing is sent. How should I tackle this problem? In this post a very similar situation is asked and something is suggested but it's not the solution anymore.

1 Answer 1


OS X has postfix installed by default but it's not enabled (started). You can start it with

sudo postfix start

you can check the status and eventual problems in /var/log/mail.log

The configuration is in /etc/postfix/

  • Thank you. I started postfix as you said and tried again and failed again! checking the log it is telling me [my ip]:25: opration time out any suggestions?
    – Pouya
    Apr 24, 2013 at 16:42
  • Do you have any firewall?
    – Matteo
    Apr 24, 2013 at 16:43
  • I tried from home and it seems it is working. Probably it was a problem with internet connection at my work palace. Just one last question, should I stop postfix after or I can leave it running?
    – Pouya
    Apr 24, 2013 at 21:17
  • You can leave it running. I would look online for the manual and check the configuration but as far as I remember the default settings are OK.
    – Matteo
    Apr 25, 2013 at 5:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .