Configuring a Mac for an Always-on Operation
19565 Views, 13 Favorites, 0 Comments
Configuring a Mac for an Always-on Operation
This instructable outlines how to prepare a Mac running OS X for use in an always-on setting. Interactive installations, projection experiences, robotic displays, servers, kiosks, and more all require dedicated computers that will behave reliably. When a computer doesn't have a keyboard, monitor, or mouse, it is often referred to as 'headless'.
In this example, the computer has none of the following, but the steps should apply for other situations.
- No keyboard
- No mouse
- No access to the physical machine at all (ie. no power button access)
- No monitor
- Uninterrupted power(fingers crossed)
- Reliable internet
Due to their small size, the Mac Mini is a frequent choice for a computer. The base model starts at $499, which is relatively cheap for a Mac. This tutorial focuses on software, so any model should do. I am running 10.10 Yosemite, but steps will be similar for any recent version of OS X.
For the sake of ease, this Instructable uses a keyboard mouse and monitor for set up, but all the steps are possible using these steps from OS X Server: Setting up a remote server on support.apple.com.
- VNC Screen Sharing is used to control the keyboard and mouse remotely while seeing and hearing the output of the target machine
- SMB File Hosting may be implemented for file access
- SSH Terminal Access can be set up to allow terminal access
- Sleep and screen saver should be disabled
- All software updates should be disabled
- A Text-To-Speech script for reading aloud the IP Address on boot
These are the steps to perform before you get going with whatever cool thing you are running on the computer. For that you might use openFrameworks, Cinder, Chrome, Processing, MaxMSP, PureData, Milumin, MatLab, or 1000s of other really neat pieces of software.
General - Don't Prompt for Login and Accept Apps From Anywhere
Don't Require Password
- Open System Preferences > General
- Uncheck Require password
-
Uncheck Disable automatic login
Never require the password. No reason to stall the boot up when there isn't a keyboard. This must be used in conjunction with Autologin, or it will not boot.
Accept apps from anywhere
With the advent of the App Store, Apple has tried to lock down 3rd party software. Fix that. Most custom software is not going to be certified. Optional, but very likely to be needed.
- Check the Anywhere box.
Desktop & Screen Saver - Disable Screensaver
Screen savers are a relic of the age of CRTs and Plasma displays. It could interfere with your installation.
- Open System Preferences > Desktop & Screen Saver
- Select Never from the Start After dropdown
Your screen cannot be saved when you do not have a screen.
Notifications
Disable all of them, just to be paranoid.
The App Store will notify no matter what, so it is important we disable updates, especially if your installation has sound or video.
Energy Saver - Disable Sleep, Enable Autoboot on Power Loss
Energy is precious and we should use less of it. In this case, lets forget that. If your installation goes to sleep, it isn't awake and that could be bad.
- Open System Preferences > Energy Saver
- Slide the sliders to Never. Feels good, right?
- Be sure to check Start up automatically after a power failure. You won't be around to push the tiny button.
Never sleep. Never surrender.
An Uninterruptible Power Supply(UPS) should be used if you want to be thorough. They will prevent data loss in the inevitable event of a power failure.
Sharing — Remote Access Display With VNC and File Sharing
Sharing is caring, and is our bread and butter. The VNC setup on a Mac is incredibly easy.
- Open System Preferences > Sharing
- Check Screen Sharing
- Click [Computer Settings]
- Check Anyone
- Set a good password
- Check File Sharing
- Check Remote Login
Screen Sharing
OSX ships with an awesome VNC client called Screen Sharing. You can launch VNC:// URLs from safari and they will launch in Screen Sharing.
There are also VNC clients for iOS, Android, and Windows that allow you to control the installation from your pocket. Pretty cool.
Weird Dongle
If your installation doesn't have a screen, you may encounter issues due the way the display card works. The resolution of the your view and your performance will be limited when no monitor is plugged in. As a clever solution to this problem a Display Emulation Dongle can be purchased that fakes a 1080p screen for a better VNC experience. They are $15 and they make the computer faster by enabling the GPU. Seems strange to me that one needs to buy hardware to solve what I see as a bug, but c'est la vie.
File Sharing
You may want access to the remote computer's file system. It is easy, just check the box!
Remote Login
SSH is important to many advanced projects. It allows you to securely access the Terminal of a remote device.
Bluetooth - Boot Without Keybaord
When an OS X desktop is turned on without a keyboard or mouse, it gets nervous and starts asking questions. Disable those questions.
- Open System Preferences>Bluetooth
- Click [Advanced]
- Uncheck:
- Open Bluetooth Keyboard Setup Assistant at startup if no Keyboard is detected
- Open Bluetooth Keyboard Setup Assistant at startup if no Mouse/Trackpad is detected
Users & Groups - Auto Login
- Open System Preferences > Users & Groups
- Click [Login Options]
- Select Automatically Login as the Administrator
It is very important you set a password. Screen Sharing, VNC, SSH, and pretty much anything remote will require you have one. It cannot be blank. It is also important that the computer automatically logs in when it is restarted.
Software Update or App Store - Never Update
Updates are great, but dangerous. If it ain't broke, don't fix it. Lets keep this guy in the dark.
- Open System Preferences > App Store or Software update depending on your OS X version.
- Uncheck Automatically Check for Updates
This Mac will know nothing of the outside world. It will never know its own age. Change is scary.
Bonus - Network - Have the Computer Speak Its IP
This is sort of the coolest step.
In order to log into the machine remotely, you need the OSX username and password as well as the hostname or the IP of the target machine. For small networks, it is possible to sniff/finger the device from another device on the same network.
Static/Dynamic IP Addresses
Due to the nature of most internet setups, the IP Address of the Mac is likely to change. If you can configure a Static IP with your ISP it will might convenience your setup, but that it outside of my expertise.
Fing is an app for iOS, Android, OSX and windows that does a really good job of identifying every device on your network. It can be really useful for finding the IPs of device you want to log in to.
Text-To-Speech Script
I was not able to obtain a Static IP, so I wrote a small app in Apple Automator that will speak the Mac's IP Address over the internal speaker 25 seconds after the machine turns on. To use it, download the .zip and unzip it. Put SpeakInfo.app someplace safe, like /Applications/. Drag it to the dock. Right click the dock icon and select Options>Open at Login. It should run once about 30 seconds after the Mac boots.
Automator comes with every mac and is a really easy way to have your computer do specific things automatically. This was my first automator project and it only took me 20 minutes to have a functional app!
It is attached below. If you want to edit/view the source, launch automator using Command+Space to launch spotlight search and typing automator. One its open, use Command+O to open a file and select the SpeakInfo.app. It was pretty straightforward to 'write'.
I got this idea from the Raspberry Pi community, who have a few different shell scripts they use to the same effect.
Downloads
Further Reading...
After writing this Instructable, I was directed to Blair Neal's excellent InstallationUp4evr guide. it outlines similar steps but goes into much more detail about error logging and such.
Tips from Blair:
- For auto boot/shutdown go to System Preferences->Energy Saver and then click [Schedule…]
- Set up error logging to automatically email you when things go wrong
I then found Jan Vantomme's similar article that has some good ideas about ensuring your desktop background looks like your installation, as well as how to disable your dock and your desktop icons.
Tips from Jan:
- Hide the desktop icons by typing
defaults write com.apple.finder CreateDesktop -bool false
into the terminal - Auto-Hide the dock from Apple menu > Dock > Turn Hiding On
Also, Eva Schindling has a similar guide for Windows, if you are into that sort of thing.