Macos – Terminal ‘last’ command doesn’t display login history

macosshellterminal

The last command in Terminal (on Mac OS X 10.11.2) is supposed to display a list of login history. However, when I type it in, all I get is

user$ last

wtmp begins Mon Jan 11 13:17
user$ last user

wtmp begins Mon Jan 11 13:17
...

The date printed is the current date and time. Is there something wrong with my system? Might it have something to do with the fact that I have a brewed bash 4.3 in /usr/local/bin?

Since last doesn't work, are there any alternatives? I'm trying to write a shell script that can figure out how long it's been since the login before the current session.

Best Answer

It turns out I didn't have read access to the log file /private/var/log/system.log, so last didn't display anything. I just have to run sudo chmod 644 /private/var/log/system.log.

Related Question