0

I'm struggling to find out what version of /usr/bin/time I have, on my M1 macOS 13.2.

/usr/bin/time seems to have no help beyond a usage string (that has options for help nor version).

This is what I get when trying various things:

$ /usr/bin/time -v
/usr/bin/time: illegal option -- v

When I type man time, I get some docs that say at the bottom:

STANDARDS
     The time utility is expected to conform to ISO/IEC 9945-2:1993
     (``POSIX'').

HISTORY
     A time utility appeared in Version 3 AT&T UNIX.

macOS 13.2                     January 15, 2021                     macOS 13.2

The "version" seems to be macOS 13.2 (January 15, 2021) then? But I'm not sure which exact man page is pulled in when I type man time as there are in-built commands for time as well in bash and zsh. How can I be sure that this is the man page for /usr/bin/time.

2
  • 1
    You were closed on SO because it isn't specifically a programming question, but rather to be OS related. They're very strict about that. It could be argued your question could be in the context of system administration. Mar 10, 2023 at 9:23
  • man doesn’t know about internal commands of bash/zsh, so man time always shows the man page of the time binary.
    – nohillside
    Mar 10, 2023 at 14:56

2 Answers 2

3

The time command included with macOS is open source. For macOS 13.2, the links start here. Follow the GitHub link for shell_cmds-278 to here, then the folder time to here and you will find the man page source time.1 and the source time.c

You can download the man page source and enter the command man ./time.1 to view a formatted version of the downloaded man page.

BTW, there is no version to be found in the source code time.c.

3
  • 2
    Have you ever tried using what as in- what /usr/bin/time ?
    – fd0
    Mar 10, 2023 at 12:17
  • 1
    what – show what versions of object modules were used to construct a file Mar 10, 2023 at 12:40
  • 1
    @fd0: I have spent huge amounts of time search the open source for code without knowing the what command would have told me where to look. Nuts. Mar 10, 2023 at 12:47
1

If you ask which time you get time: shell reserved word. It is documented in the man page for your shell e.g.

% man zshmisc
...
 time [ pipeline ]
              The pipeline is executed, and timing statistics are reported on the standard error in the form specified by the TIMEFMT parameter.  If
              pipeline is omitted, print statistics about the shell process and its children.

man time specifically references /usr/bin/time in the text. So it's fair to assume that's how the docs match up.

Using /usr/bin/time options with the builtin throws errors, so I'm not sure if they are identical. If you need the options, use /usr/bin/time explicitly.

As to the versions, I would suggest the builtin version is that of the shell, and /usr/bin/time corresponds to your macOS version for the lack of any -v option.

1
  • Thanks for confirming my suspicion! Apparently the man pages live entirely separately from binaries. I was hoping there would be a way to get man pages for a specific executable specified by exact path but alas no - unless I'm missing something. Mar 10, 2023 at 9:38

You must log in to answer this question.

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