Tips and Resources

MacOS automatically install & configure printers using .pkg package

Guide for deploying MacOS printer preferences and drivers using a .pkg 

  1. Set up a reference computer with the printers installed and configured in the way you'd like to deploy to others.
  2. Stop the cups service (open terminal and run sudo launchctl stop org.cups.cupsd ).
  3. Click Finder, Click Go -> Go to Folder. Type /etc/ Click Go.
  4. Copy the cups folder from etc to a location we can easily get to (such as the desktop).
  5. Install Packages from: http://s.sudre.free.fr/Software/Packages/about.html
  6. Once installed open Packages.
  7. Create a new Raw package, give it a name and make a note of the package path & click Create.
  8. Click the Settings tab and change the Post-installation behaviour to Require Restart.
  9. Click the Payload tab, Select the disk icon with the red target icon then right click in the site space in the main pane and create a new folder called etc
  10. Select the etc folder, click the + at the bottom of the window and choose the cups folder you copied earlier. Repeat this process for all the files and folders in the cups folder. Make sure to mirror the cups folder hierarchy in the Contents window. I've found that the certs folder folder can remain empty.  
  11. Download the .pkg installers of the drivers for each printer you are installing using this package.
  12. Create a new text file named preflight.sh and paste in the following code:

    #!/bin/sh

    ### Printer Config PreFlight Script
    ### http://bdts.com.au

    # Make sure CUPS is running
    sudo launchctl start org.cups.cupsd

    # Reset Printing System
    sudo lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}

    # Install two FX printer driver packages from the installer

    install_dir=`dirname $0`

    sudo /usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Fuji Xerox PS Plug-in Installer.pkg" -target /
    sudo /usr/sbin/installer -dumplog -verbose -pkg $install_dir/"Fuji Xerox Print Driver for Mac OS X Installer.pkg" -target /

    # Stop CUPS for the next part of the installation process
    sudo launchctl stop org.cups.cupsd

  13. Modify the sudo /usr/sbin/installer... lines to match the driver .pkg file names. Add or remove those lines as necessary (for example, if you only are installing 1 printer driver, remove the 2nd sudo /usr/sbin/installer... line. Save the file.
  14. Create a new text file named postflight.sh and paste in the following code:

    #!/bin/sh

    ### Printer Config PostFlight Script
    ### http://bdts.com.au

    # Start CUPS
    sudo launchctl start org.cups.cupsd

  15. Make sure the pre and post flight scripts are executable. (open terminal, navigate to the folder that contains the script and run sudo chmod +x preflight.sh  and sudo chmod +x post flight.sh
  16. Back in Packages, Click the Scripts tab. Add the preflight.sh and postflight.sh scripts to the Pre- and Post- installation sections and add the driver installation .pkg files to the additional resources section.
  17. Click Build in the menu at the top of the screen, and choose Build. After a few moments the package build will complete and you'll have a package in the path you set in set 7 that you can install on user's machines.