Terminal 'last' command doesn't display login history

8,916

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.

Share:
8,916

Related videos on Youtube

Honesty
Author by

Honesty

Nothing special to tell you.

Updated on September 18, 2022

Comments

  • Honesty
    Honesty over 1 year

    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.

    • Xen2050
      Xen2050 over 8 years
      sudo last make any difference?
    • Honesty
      Honesty over 8 years
      Ahh, yes, that did work. I did some research and discovered the problem is that I didn't have read-access to private/var/log/system.log. Thank you!
    • Xen2050
      Xen2050 over 8 years
      Lots of things act differently with & without sudo, it's something to try if a system-type command like that doesn't work, as long as you know what it should do, and it doesn't have the potential to erase any important files or drives that is.