17

What's binary that will give exact result for Linux's time command flags?

alias tcmd='/usr/bin/time \-f\ "CPU: %Us\tReal: %es\tRAM: %MKB"'

Current time in Mac OSX for command above is:

/usr/bin/time: illegal option -- f
usage: time [-lp] command.
2
  • Why not set the TIMEFORMAT variable and use bash's builtin time.
    – fd0
    Apr 19, 2016 at 11:01
  • I've tried export TIMEFORMAT="CPU: %Us\tReal: %Es\tRAM: %MKB" but it shows -bash: TIMEFORMAT: 'M': invalid format character
    – Kokizzu
    Apr 19, 2016 at 11:32

1 Answer 1

35

Nevermind, found it:

brew install gnu-time

the command is gtime

3
  • 2
    Great! Please mark this as solved.
    – JMY1000
    Apr 19, 2016 at 3:47
  • 1
    Awesome, added this to my list of fresh install items for any new Mac OS Jan 30, 2020 at 20:16
  • I use this in my .zshrc: alias time='gtime'
    – Sid110307
    May 19 at 17:00

You must log in to answer this question.

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