Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not sure why, but on my Macbook Pro running lion I get slow updates when I issue "tail -f" on a log file that is being written to. I used to use this command all the time at my last company but that was typically on Linux machines. The only thing I can think of that would possibly slow the updates are buffering of output and/or maybe a different update interval on a Mac vs. Linux. I've tried with several commands all which write to stout relatively quickly but give slow updates to the tail command. Any ideas?

Update I am merely running a python script with a bunch of prints in it and redirecting to a file vi "> my output.log". I expect to see updates near real time but that doesn't seem to be the case.

share|improve this question

migrated from stackoverflow.com May 25 '12 at 21:59

This question came from our site for professional and enthusiast programmers.

    
This question might be related to yours: stackoverflow.com/questions/10710454/… –  betabandido May 24 '12 at 22:56
    
How slow is it? –  Keith Thompson May 25 '12 at 2:38
    
It really looks like a buffer issue. I spits out chunks of output all at once and doesn't update realtime. I looked at the other thread mentioned about and there doesn't seem to be a stdbuf on OS X. I'm mostly sure its buffering before dumping the output issue I just don't know how to fix it. –  Cliff May 25 '12 at 3:25
add comment

1 Answer 1

System expects more patience from a filesystem than from average user sitting at the console and is buffering output not going to terminal. Also terminals are better suited to handle lines on input than filesystems, which always work with blocks. Flushing result after every line impacts performance, but that may not be an issue for your usecase.

To turn off buffering you can run the script with python -u SCRIPT or use unbuffer from expect package (which may not be available for Mac).

share|improve this answer
    
Wow, I forget which python script I was running or what I was actually trying to do when I posted this. Thanks for the feedback and I'll give it a try if I can remember what "IT" was! lol! Thanks again! :) –  Cliff Nov 28 '12 at 17:36
add comment

Your Answer

 
discard

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.