3

So i know i can manually tail files using

tail -f filename.log

Question

I would just like to double click any .log files and have them open with Terminal using tail -f

Backgrounds

i am a long time windows users, and i have always used baretail but this is my work MAC so i can't just install or download any software would love to use just out of box tricks

Edits Not launching from console but more of like i open the .log and they can open in Terminal itself and then i don't mind just leaving that Terminal or multiple Terminals while i am viewing them

  • Feel free to ask follow on questions / ping me in my answer or here. Happy customizing :-) – bmike Mar 20 '16 at 16:42
2

There isn't an easy way to change the opener of the files and inject tail.

However, you could make very simple shell scripts and have them open the appropriate commands at log in time:

Also, you can set up several windows and several tabs with different font, color, arrangement (even across multiple Mission Control desktop spaces) and then have terminal open the group. Terminal's help has some tips on both AppleScript automation and using Window Groups (export/import) is possible to edit the xml configuration files for advanced cases.

For me, I just define aliases that are easy to type in my . initialization scripts.

alias tf=`tail -F`
alias tailf='tail -F /var/log/system.log`
alias upd=`tail -F /var/log/install.log`
alias mas=`tail -F /var/log/commerce.log`

So you can tf an arbitrary file or easily kick off specific files of interest rather than scripting a file to run a specific command. It really depends if your brain likes to bring a new window to an existing file or a new file to an existing window.

0

One thing to keep in mind here is that system.log rotates and is compressed periodically. If you have an open tail -f to the file, sooner or later you will notice that no new updates are arriving to it. This is because the system.log file you are pointing to has been deleted, and a new one started. The solution is to ctrl-break and restart the tail.

You must log in to answer this question.

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