Enable Remote Access – Command Line

To enable Remote Management from the command line, enter the following into Terminal

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -users ARDADMIN -access -on -restart -agent -privs -all -allowAccessFor -specifiedUsers -computerinfo -set1 -1 "INFO1" -set2 -2 "INFO2" -set3 -3 "INFO3" -set4 -4 "INFO4"
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart --configure -access -on -privs -all -users ARDADMIN

You will need to switch ARDADMIN for the account you wish to give ARD access to.

INFO1, INFO2, INFO3, INFO4 refer to the fields located in System Preferences, Sharing, Remote Management, Computer Settings


To enable SSH for one specific user, enter the following into Terminal

sudo systemsetup -setremotelogin on
sudo dseditgroup -o create -a USER -t user -u USER -q com.apple.access_ssh

You will need to change USER for the shortname of the user you wish to grant SSH access to.

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

Managed Preferences – Cache Flush


The other day I was trying to access some restricted preferences on a 10.6 client, bound to a 10.6 Server that no longer existed, and because of this, I had no way of removing the restrictions

Or so I thought, thankfully Apple had provided a Knowledge Base article detailing how to manually flush the cache, enabling access to the previously restricted preferences.

To do this, I opened up Terminal and input the following command all on one line

dscl . -list Computers | grep -v "^localhost$" | while read computer_name ; 
do sudo dscl . -delete Computers/"$computer_name" ; done

This worked, I was able to amend the settings needed, I have provided the link to the Apple page below, in case you need information on how to do this on earlier OS’s