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

Re-enable Java 6

Command Line System ConfigIf you are running Mac OS X 10.8 and have installed Java 7, as well as the latest Java Update from Apple (Java 2013-002) and have found that some things don’t work with Java 7, and you wish to change back to having version 6 as your default Java installation, then you can download the script – Enable_Java6.sh from the link below

Enable_Java6.sh

Extract the file, copy it to the desktop

Open Terminal & type the following

cd ~/Desktop
sudo ./Enable_Java6.sh

this script only takes a second to run, once its complete, go to this website to check the version of Java that you have enabled

http://javatester.org/version.html

for information on what the lines in this script do, check out the Apple support page below

http://support.apple.com/kb/ht5559

If you wish to undo this and switch back to Java 7 then you can enter the following into Terminal

sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws /usr/bin/javaws

Then you can download and install the latest Java Runtime from the following link

http://www.java.com/en/download/mac_download.jsp?locale=en