How to read Sierra’s unified log as a normal user

If you’ve tried browsing Sierra’s new unified log from a normal user account in the last few versions of macOS, you will have discovered that it is a futile exercise: whether you use Console, Consolation, or the log command in Terminal, you are unable to see any log entries at all.

It’s not that any of those tools informs you that you can only see log entries when an admin user, the log just appears completely blank, without any entries at all.

So, what if you normally use your Mac from a normal user account, or you’re trying to address a problem which only occurs in normal user mode? Does this stop you?

No: log entries are still made normally when your Mac is running a normal user account. The unified log always collects all entries, regardless as to which user they relate to.

If you can, the best way to use Consolation, Console or log is to log out and log back in as an admin user, or to use fast user switching to change to an admin account. These are by far the most secure and safest ways to do this, and restore full access to the log.

If you cannot do any of those, there are methods of running Consolation 2 from the root user account, which normally involve commands in Terminal. You can use those, such as entering the following:
osascript -e 'do shell script "/Applications/Consolation2.app/Contents/MacOS/Consolation2" with administrator privileges'
(as pointed out in Eric’s comment on this blog).

You could also run this directly in AppleScript, using the code
do shell script "/Applications/Consolation2.app/Contents/MacOS/Consolation2" with administrator privileges

For many ordinary users, using Terminal or AppleScript is not a good option. I therefore now offer you a little app, RunConsolation, which will do exactly this. It is available from the Downloads menu above.

All RunConsolation does is to run the following Swift 3.1 code:
let appleScript = NSAppleScript(source: "do shell script \"/Applications/Consolation2.app/Contents/MacOS/Consolation2\" with administrator privileges")
let eventResult = appleScript?.executeAndReturnError(nil)

The first line sets up the line of AppleScript code ready to be run. The second then executes that line of AppleScript, and gets the result back when you finally quit that copy of Consolation.

There are some serious disadvantages to using the AppleScript code, shell commands in Terminal, and RunConsolation. Most importantly, the copy of Consolation is not run as an admin user (as it is when run from a normal admin account), but as root. If your Mac was hosting some malware, perhaps, it could potentially hijack that to give itself root privileges, and take complete control of your Mac. That is a risk which you run whenever you choose to run any app as root.

Because the root user doesn’t have a Home folder with a Library and Preferences, when running Consolation as root, you cannot save or use preferences. This means that you will have to set up each window in the app afresh, I am afraid.

However, for those who need to run Consolation from a normal user account, I hope that RunConsolation proves useful. Please use it wisely.

In case you’re wondering, I did think about building a tool which was more flexible, and let you run Console or other apps as root. I felt that, because of the security implications, that could easily lead users into danger. Hence RunConsolation is locked down to run Consolation2 from your main Applications folder, and no other app.