Note: I recently had to prepare a Mac mini for use as a network testing device. The system was installed in a remote location and only reachable via SSH.
Important commands: hdiutil, installer, softwareupdate, shutdown
When preparing a system for production, there are three main tasks that need to be completed:
-
Update the Operating System
This is by far the easiest, if not longest, part of the process. All you have to do is update the system software and reboot. That's it. The main issue here is that updating the system software takes a long, long time. Here are the commands you'll have to run.</p>
# softwareupdate --install --all
This command will go through the process of looking for necessary updates, and then downloading, expanding, and installing them. How long this takes is dependent on how long it's been since the system was updated. When I did this, the install was fresh and at least 1 Gigabyte of updates were necessary. Once that command completes, you'll likely need to reboot (the output from
softwareupdate
will let you know if that's necessary or not).# shutdown -r now
Thank you. Next!
-
Install the Xcode Development Tools
Without the Xcode Development Tools, Mac OS X has no way to compile new software. Darwin Ports (where all the Linux-y tools live) needsgcc
in order to compile new ports. Unfortunately, Xcode requires a login with Apple Developer Connection in order to download it. Basically, that means you need to use a web browser rather thanwget
orftp
to grab it. (In my case, I downloaded the DMG locally and usedscp
to copy it to my host.) Once the Xcode DMG is on the system, here's the summary of commands necessary to install the tools. Keep in mind that the actual file name for the Xcode tools may be different in your case.</p>
# hdiutil mount xcode_2.4.1_8m1910_6936315.dmg
# cd /Volumes/Xcode\ Tools/
# installer -pkg XcodeTools.mpkg -target "/"
# cd ~
# hdiutil detach /Volumes/Xcode\ Tools/
The process is really quite simple: mount, install, unmount. This is the same basic formula we'll follow in the final step.
-
Install Darwin Ports
Like the Xcode Development Tools, you will need to get the Darwin Ports installer from their website. Instead of making the DMG available for easy download, you again need to jump through some hoops to gain access to the file. So, download the DMG to your local host andscp
it to the system you are working on. Once that's done, you can get back down to business.</p>
# hdiutil mount DarwinPorts-1.2.1-10.4.dmg
# cd /Volumes/DarwinPorts-1.2.1/
# installer -pkg DarwinPorts-1.2.1.pkg -target "/"
# cd ~
# hdiutil detach /Volumes/DarwinPorts-1.2.1/
You should now have the Darwin Ports package installed in
/opt/local
. (My .profile was automatically updated to include/opt/local/bin
and/opt/local/sbin
in$PATH
.) The last step is to update the ports package.# port -d selfupdate
This will ensure that Darwin Ports is completely up to date. From there you can use the
port install
syntax to install your preferred CLI software.
That should be all you need to do to have your remote system ready to go. Any tools you need can be installed easily with Darwin Ports.