Skip to content

Latest commit

 

History

History
364 lines (276 loc) · 12.1 KB

setup-macosx.md

File metadata and controls

364 lines (276 loc) · 12.1 KB

Setting up Mac OS/X Systems

For Mac OS/X development, we use a high power Macintosh system (currently Mac Pro), set up as an infrastructure system, to run a number of different virtual machines (for build, development, or test purposes).

For virtualization, we are using VMware Fusion, native on Mac OS/X.

Note that, with only a few exceptions, Mac OS/X infrastructure hosts and Mac OS/X build/development hosts are set up identically. The instructions below will call out the differences to minimize maintenance to these instructions.



Setup Instructions

Default Account

In general, the default account username is admin (full name: Administrative Account). It is easiest to set this up during Operating System installation, although if you set up some alternate account, you can create the admin account later.

In particular, we do not use the serviceb account on either infrastructure systems nor development systems. Build systems do use serviceb.

User accounts (be it for an end-user, or the serviceb account) should NOT have "Allow user to administer this computer" enabled on the System Preferences/Users & Groups dialog. Instead, they should use the sudo mechanism for sudo access as needed.

System Updates

Install all updates available from the App Store application (available under the Apple menu from the menu bar). Note that Jeff Coffler has created an iTunes account tied to his E-mail ([email protected]). Contact him for the password if needed.

After all updates are installed, navigate to System Preferences/App Store and, for "Free Downloads:", select Save Password. Here is a dialog to set everything properly:

Left

These settings will automatically apply updates, and will not require the iTunes password for each update.

Set Up sudoers File

After the commented out %wheel line, add a new line for %staff as follows:

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
%staff ALL=(ALL) NOPASSWD: ALL

System Preferences

The follow table indicates the settings that must be changed in the System Preferences screens:

Component Setting
Desktop & Screen Saver Select Message screen saver so, if screen saver is activated, it won't eat lots of CPU time to display fancy graphics.

For infrastructure system: In Screen Saver tab, select Start after: Never in pulldown. This avoids screen saver from wasting CPU time for VMs.

For virtual machines, execute the following command:
sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0
Energy Saver
  • If you have a slider for Computer sleep:, set it to never
  • Check: Prevent computer from sleeping automatically
  • Check: Wake for network access
  • Check: Start up automatically after a power failure
Sharing Name system appropriately (i.e. ostcdev-mac1011-01).

Select:
  • Screen Sharing (with VNC configured in Computer Settings...)
  • Remote Login
Network Configure the active network interface with DHCP.
App Store Check Automatically check for updates for all types of updates.

Do NOT check Automatically download apps purchased on other Macs.

Enable root Account

This step is NOT needed on the infrastructure system, nor on build servers. This is only needed on Developer and Test systems.

To enable the root account:

  1. Navigate to System Preferences / Users & Groups / Login Options,
  2. Select "Join..." at bottom right,
  3. Open directory utility,
  4. Unlock directory utility,
  5. From menu bar for Directory Utility, select Edit -> Enable root user

Set Up hostname

To set up the hostname for the system, launch a command terminal and type:

sudo scutil --set HostName <hostname>

where <hostname> is the name of your host. Do not append scx.com to the hostname.

Install Development Tools

There are two choices for development tools: command line tools and Xcode. Because Xcode is quite large, we only recommend it if needed.

Command line tools are sufficent for 'git' (and thus updatedns), as well as actually building/linking our products. Thus, we recommend the following tools to be installed based on system type:

System Type Development Tools
Infrastructure Command line tools
Build System Command line tools
Development System Xcode
Test System Command line tools

To install command line tools, just invoke git from the command line (from a GUI connection to the Mac). If the tools are not present, you'll be prompted what to install.

Note that Xcode is quite large, and will take several minutes to install. The lldb debugger only ships with Xcode, not the command line tools.

Install updatedns

This step differs slightly based on the type of system. See Install Development Tools for guidance on what should be installed prior to installing updatedns.

  • Launch a command terminal, and type:
git clone https://github.com/jeffaco/msft-updatedns.git updatedns

Once msft-updatedns is downloaded, issue the following commands:

cd updatedns
./updatedns.sh --configure -v

At this point, updatedns should run automatically and fix the DNS resolvers to use the SCX domain servers.

Install Homebrew

Homebrew is "the missing package manager for macOS."

Follow the installation instructions from Homebrew. The short of it is reproduced here:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Next, fix the /usr/local directory (used by Homebrew) permissions to be writable by the staff group:

This is needed because Homebrew (and macOS systems in general) tend to expect single users, not groups.

sudo chgrp -R staff /usr/local
sudo chmod -R g+w /usr/local

Install Homebrew Packages

Once Homebrew is installed, several Homebrew packages must be installed as well. This can be done with the following command:

brew install pkg-config cmake openssl

Codesign GDB

If practical, it would be better to use the debugger which is provided by Xcode for debugging purposes. That debugger is much more capable and reliable than gdb on the mac. Developers used to using the gdb debugger can find a document with translations between gdb and lldb commands here.

If you must use gdb, per the Homebrew installation notes, "gdb" requires special privileges to access machine ports. You will need to codesign the binary. For instructions, see: BuildingOnDarwin.

Since our macOS systems are shared, please check if a GDB certificate has already been created.

Codesigning GDB needs to be done each time GDB updates, XCode updates, or the certificate expires.

Increase Screen Resolution

The video resolution of Mac Virtual Machines are rather limited to conserve overall resources in a heavily hosted environment. In rare situtions (when developers must connect using VNC to the Mac routinely), it may be necessary to increase the screen resolution of a virutal machine.

When this is necessary, both administrative changes and user changes must be made to the virtual machine.

Increase Screen Resolution: Administrative Changes

VMware KB Article 1003 discusses how to increase the screen resolution for all of their products. For VMware Fusion, the steps are roughly as follows:

  1. Install VMware Tools on the virtual machine,
  2. Power off the virtual machine,
  3. Open the .vmx file on the host system (the system running VMware server) in a text editor for the virtual machine in question (expand shell bundle of the virtual machine to see this).

    Add a line to the file as follows: svga.autodetect = TRUE

    This file is generally located in the Documents folder for the administrative user, but this can be stored elsewhere if desired,
  4. Save the file,
  5. Restart the virtual machine.

If you need extreme screen resolution (unlikely), refer to VMware KB Article 1003.

Increase Screen Resolution: User Changes

Once the administrative changes has been completed and the virtual machine has been rebooted, then the user of the virutal machine must inform the VMware Tools package of the desired resolution.

This must be done via the command line on the virtual machine. The user should SSH to the host in question (or execute the command in a terminal window on the virutal machine) and enter a command like:

cd /Library/Application\ Support/VMware\ Tools
./vmware-resolutionSet 1920 1080

where 1920 is the requested width and 1080 is the requested height. Any width and height may be requested.

Beware that many VNC clients will resize or scale the window based on the VNC client physical window size. Be certain that your VNC client is not configured to do this, or that the display window of the VNC client is large enough to accomodate your requested resolution.

Creating a New Virtual Machine

To create a new VM in VMware fusion, you must first download the operating system that you wish to use (i.e. El Capitan) from the App Store. Once downloaded, it is automatically placed in the /Applications/ folder, and you need to move it to make sure it won't get installed on system reboots. Move it into the administrator's desktop folder with a terminal by executing a command like:

mv /Applications/Install\ OS\ X\ El\ Capitan.app ~/Desktop

Once the operating to install is placed at the desktop:

  • Launch VMware Fusion. This can be done via the Applications folder via the finder, or by clicking magnifying glass on menu bar and typing "VMware" in the spotlight window and hitting return. Note that if VMware Fusion is already running (normally the case for virtual machines to be running), select Window / Virtual Machine Library from the menu bar once VMware Fusion is selected,
  • Select Add (+v) from the upper left of the window,
  • Drag Install OS X El Capitan from your desktop to the "Install from disk or image" section of the "Select the installation Method" window,
  • Click "Continue" from the "Create a New Virtual Machine" confirmation window.

At this point, follow the standard instructions to configure the virtual machine from the top of this document.

Suggested hard drive sizes for virtual machines:

Machine Type Size
Build System 24GB
Development System 64GB
Test System 16GB

Note that if you must extend the disk size via VMware, then Mac OS/X won't see the additional space automatically. Boot the guest VM and issue the command (from a terminal window):

sudo diskutil resizeVolume / R

This will reformat the file system to recognize and use the additional disk space.