14

BSD time gives this kind of output

9990

real    0m4.371s
user    0m1.548s
sys 0m2.167s

GNU time gives then again this kind of output

9990
1.56s user 1.46s system 82% cpu 3.648 total

Brew search gtime gives nothing. GNU time is probably in some C library, however, I am not sure which. There is no apparent package for it.

How can you install GNU time in OSX?

5
  • 1
    Using /usr/bin/time gives me the results that you want. time by itself with a command is a shell keyword.
    – fd0
    Jul 1, 2015 at 20:40
  • 1
    @fd0 I do not get such an output. My time is also in usr/bin/time. My time version is BSD 1993. You must have different version of time. Jul 1, 2015 at 20:44
  • time date vs /usr/bin/time date produce 2 different outputs (like your examples above). But which time gives /usr/bin/time. Jul 1, 2015 at 20:51
  • brew install gnu-time Jul 1, 2015 at 20:54
  • @Masi the time man page states BSD June 6, 1993. I have no idea why your results are different.
    – fd0
    Jul 1, 2015 at 21:11

2 Answers 2

21

I think what you are looking for is available as...

brew install gnu-time

Which you can then call as...

gtime ...
5
  • 1
    you just beat me to it. gist.github.com/gregelin/9529716 Jul 1, 2015 at 20:54
  • No manuals installed by this in gtime. How can you get manuals also with this command? I would like to get more significant numbers in timing. Jul 6, 2015 at 8:39
  • 2
    The original package from GNU doesn't appear to have a man page. However it does have an info file you can find with info time. Jul 7, 2015 at 7:38
  • 1
    @LéoLéopoldHertz준영 here's an online version of the man page
    – Dennis
    Feb 3, 2017 at 17:53
  • 2
    If you want to call it as time, then install it as brew install gnu-time --with-default-names. Your original installation of bsd-time will still exist, but gnu-time will be executed by default as it appears in your PATH first.
    – Dennis
    Feb 3, 2017 at 17:57
2

GNU time is available in homebrew in package gnu-time.

You must log in to answer this question.

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