Ehcho.com

MCX: Configure default web browser

By Morgan Rowe | 23 Sep 2013

Managed Client for OS X, or MCX for short, refers to configuring preferences on managed Macs. Workgroup Manager can apply these preferences based on users, user groups, computers, and computer groups. You can create your own groups, or import them from Active Directory, or import them from an existing Open Directory server.

I'm going to assume you've got a functioning OS X server with Workgroup Manager installed. I'm using OS X 10.8.4 Server, and Workgroup Manager 10.8. The functions and techniques used in this guide can be used with OS X Lion Server. I haven't tested earlier versions of OS X, but I can't imagine there being much of a difference.

We're going to be creating a custom launch services file, which will set the default web browser to Google Chrome. You can use the same technique for setting other web browsers as default, which I'll cover later on.

Create the Property List (.plist)

Open a plain text editor. I used Sublime Text 2, but TextEdit will also work.

If you choose to use TextEdit, you'll have to ensure its plain text editing mode is enabled. You can change this by going into TextEdit's preferences, and changing the "Format" option to "Plain Text". TextEdit can be found within /Applications.

MCX:  Configure default web browser - TextEdit example

It doesn't matter which machine you create the Property List on, but the file will have to be copied to your server at some point. You could install Workgroup Manager on your day to day Mac, and configure the preference from there, but as you can VNC into your server from any Mac, there's not much point in doing this.

Copy and paste the following code into your plain text editor:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>LSHandlers</key>
    <array>
      <dict>
        <key>LSHandlerRoleAll</key>
        <string>com.google.chrome</string>
        <key>LSHandlerURLScheme</key>
        <string>http</string>
      </dict>
      <dict>
        <key>LSHandlerRoleAll</key>
        <string>com.google.chrome</string>
        <key>LSHandlerURLScheme</key>
        <string>https</string>
      </dict>
      <dict>
        <key>LSHandlerContentType</key>
        <string>public.html</string>
        <key>LSHandlerRoleViewer</key>
        <string>com.google.chrome</string>
      </dict>
      <dict>
        <key>LSHandlerContentType</key>
        <string>public.url</string>
        <key>LSHandlerRoleViewer</key>
        <string>com.google.chrome</string>
      </dict>
    </array>
  </dict>
</plist>

Save it to your Desktop as "com.apple.LaunchServices.plist".

Although the file may look complicated it's pretty simple to understand. You're basically telling the Mac to forward the "http", "https", "public.html", and "public.url" calls to "com.google.chrome", which is the bundle identifier for Google Chrome.

Set other browsers as default

Each application has its own bundle identifier. Here's the identifiers for the most common web browsers for OS X.

Browser Bundle ID
Safari com.apple.Safari
Google Chrome com.google.chrome
Opera com.operasoftware.Opera
Firefox org.mozilla.firefox

Simply replace the bundle identifier within this snippet with the one for your web browser.

If your browser isn't listed here, or the list becomes out of date, you can retrieve the bundle identifier yourself.

Copy plist file to the server

If you didn't create the plist file on the server, copy the file to it now. If you're not sure how to do this, use a USB memory drive.

Set preference for all users

Now let's open Workgroup Manager. Your setup may differ from mine, and if it is, don't worry. I've got two groups, which together encapsulate all of my users.

Select all the groups that you want to apply the default web browser to. Click on "Preferences" from the tool bar, and then select the "Details" tab. If you've uploaded your own preferences, or edited preferences within the "Overview" tab you'll see a list of Property List files within the box already.

MCX:  Configure default web browser - Workgroup Manager preference pane

Click on the plus button, and browse to the location where your com.apple.LaunchServices.plist file is located, which should be on the Desktop.

Select it and ensure the "Manage imported preferences" is set to "Often". You can change this option if you want, but choosing "Often" will enforce the configuration. A user may be able to change the default browser when the "Often" option is chosen, but when they log out and back in, it should be changed back to Google Chrome.

MCX:  Configure default web browser - Choose the com.apple.LaunchServices.plist file

You can also associate this preference with a specific user, computer, or computer group, but if all of your Macs use the same browser, it doesn't matter where you apply the preference.