Disable Gatekeeper – Command Line

To ‘allow applications downloaded from anywhere’ from the command line, enter the following into Terminal

sudo spctl --master-disable

This changes the option located in System Preferences, Security & Privacy, General

This will allow you to install software from sources other than the Mac App Store

Energy Settings – Command Line

So, to set the energy settings via the command line, do the following

Open Terminal and type

sudo systemsetup -setsleep never

This tells your Mac to never sleep, ideal for a server, or a machine running digital signage


To set the display to sleep after 15 minutes type the following into Terminal

sudo systemsetup -setdisplaysleep 15


To set the machine to wake up when being accessed remotely, type the following into Terminal

sudo systemsetup -setwakeonnetworkaccess on


The following ensures the machine boots up every Saturday at 10pm, this is so I can run some maintenance tasks

sudo pmset repeat wakeorpoweron S 22:00:00


This next command disables the ability to sleep the machine by pressing the power button

sudo pmset powerbutton 0


And this last one tells the machine that it should automatically restart after a power failure

sudo pmset autorestart 1

Mac Mail – Ghost Unread Count


So, after having the problem with ghost unread mail appearing on my iPhone, I then had to deal with this on the Mac Mail app.

This has happened before, and can usually be simply fixed by clicking on the offending folder (usually Inbox), then clicking on ‘Mailbox’ in the menu bar, then clicking on ‘Rebuild’

it takes a little while but usually resolves the issue, this also works pretty well if the inbox is showing no messages at all, just a blank window, anyway, back to the problem, so this time, this didn’t work, so I had to resort to a more drastic rebuild.

First, quit Mail

Once it is no longer running, click on Finder

then press SHIFT, CMD, G

then paste in the following location and click on Go


In that folder you need to remove all files starting with EnvelopeĀ (usually Envelope Index, Envelope Index-shm, Envelope Index-wal), normally, I move these to the Desktop until everything is all working again

Once there are no files starting with Envelope in that location, then click on Mail to Rebuild the Index, Once this has finished, your mail should be back to normal, no missing unread items.