Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a background process on Mac and have a problem with log update. If I run

someprog > mylog &

then mylog is updated not immediately, but with some intervals - I guess it's due to buffering. If I kill the program before output is written to the log, then I loose the data. There was no such problem with the same program on Linux machines, so I hope I can make it run-time-updated on Mac as well. Any idea how?

someprog is a F77 program, which was not written by me.

share|improve this question

One solution is to use the expect command unbuffer, which redirects output to a pseudoterminal. In UNIX-like operating systems terminal output is line-buffered while non-terminal output is buffered (4k on my OpenBSD workstation)

$ sysctl hw.pagesize       

See also

share|improve this answer

Is the program myprog an application you have written yourself?

If so, you can force it to flush the output buffers at each write statement. Output is buffered in most cases by default to avoid excessive I/O but in this case it looks like you want to get everything right away.

share|improve this answer
Unfortunately, it is not my program, so I hope there is a way to flush it somehow from the system side. – Andrei Sep 21 '10 at 13:36
Do you have access to the source? and are building it yourself? – dtlussier Sep 24 '10 at 20:29
I don't feel like changing the source. It works fine on Linux machine, so it should work on Macs as well. It must be a system setting. – Andrei Oct 1 '10 at 14:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.