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

Command Line System Config

To change a number of system settings via the command line you can use the systemsetup command in Terminal

For example, to change a computers name you would enter the following

First, find out the current name

sudo systemsetup -getcomputername

then if its not to your liking enter

sudo systemsetup -setcomputername "iAM_iMac"

This will change your computer name to iAM_iMac, I don’t like spaces in names so I subsitute them with underscores _, but you can call the machine anything you wish.

Another useful option is setting a network time server, to do this enter the following

sudo systemsetup -setnetworktimeserver ntp0.itsallmacademic.com

In my example my Mac will now try to get its time settings from ntp0.itsallmacademic.com, you will need to replace this with your own time server, as there is no time server at the above address.

I don’t like power failures, and the most annoying thing is having to boot up all the machines that are essential to the day to day running of the company, to get around this irritation I do the following on all my Mac Servers

sudo systemsetup -setrestartpowerfailure on

This sets the machine to boot itself up after a power failure, as all good servers should

If you wish to see the full range of commands at your disposal enter this

systemsetup -help

Command Line Network Configuration

To change network info from the command line you can use the following commands in Terminal First you will need to find out which services are available to configure, you do this by typing
sudo networksetup -listnetworkserviceorder

You will get varying results depending on the machine you are running this on, on a MacBook Air for example you will get something like this

(1) Bluetooth DUN (Hardware Port: Bluetooth DUN, Device: Bluetooth-Modem)
(2) Wi-Fi (Hardware Port: Wi-Fi, Device: en0)
(3) Bluetooth PAN (Hardware Port: Bluetooth PAN, Device: en1)

On an iMac something like this

(1) Bluetooth (Hardware Port: Bluetooth, Device: Bluetooth-Modem)
(2) FireWire (Hardware Port: FireWire, Device: fw0)
(3) Ethernet (Hardware Port: Ethernet, Device: en0)
(4) AirPort (Hardware Port: Airport, Device: en1)

Now, to set a manual IP address on the Ethernet Port enter the following

sudo networksetup -setmanual "Ethernet" 10.1.10.2 255.255.255.0 10.1.10.1

The first number (10.1.10.2) is the IP Address you wish to set, the second (255.255.255.0) is your Subnet Mask, the third number (10.1.10.1) is your Gateway or Router address, obviously you would replace the details above with your own IP, Subnet Mask, Gateway.

To set DNS servers enter the following

sudo networksetup -setdnsservers "Ethernet" 8.8.8.8

Again, you would set them to your own DNS server, or you can try Googles Public DNS as I have in the example

And finally, to set your search domains, enter the following

sudo networksetup -setsearchdomains "Ethernet" itsallmacademic.com

And thats all there is to it

For a full list of configuration options type

networksetup man

Hidden printer options

Now the default printer options in the System Preferences Pane are not that extensive, so to get access to a range of extra options you can access the CUPS conifguration pages you need to do the following:

Open a web browser

Enter http://localhost:631 into the address bar

hit enter and you will have access to a bigger range of printer options

My iOS device is talking to me

If you have recently set up an iOS device then you may have encountered an issue where the device will keep talking to you, telling you what you are pressing etc.

To disable this, you will need to do the following

Go into Settings

Then go into General

Then Accessibility

You should find that VoiceOver is currently enabled, so switch this off

Problem solved