Choose your language

Choose your login

Contact us

Starting the Client on macOS with Launchd

THE PAGE APPLIES TO:

NOTE: If you’re after further information on the PaperCut User Client with macOS, check out the PaperCut the PaperCut manual page.

💡 Looking for something simpler?

It’s worth mentioning that this article is aimed at system administrators who need to configure multiple systems to auto-start the PaperCut client for all users.

If you have a Mac and you’re just wanting to configure the client to automatically start (if you’ve already copied your organization’s PCClient.app to the /Applications folder on your Mac) then you can just add the app to the login items through System Preferences → Users and Groups → Login items.

Why Launchd?

For Macintosh computers running OS X 10.7 and later, and most especially macOS X 10.10 Yosemite and later, launchd is the most practical approach to launching the PCClient.app. As Apple has begun to focus heavily on securing root access to systems Login Hooks have been deprecated in favor of LaunchDaemons and LaunchAgents and have safer, less wide-reaching system access.

We highly recommend using the Launch Agent method described below. Apple also recommends using this method as opposed to using a login hook, as described on their Apple Developer website. For an in-depth guide to launchd and how it operates you may wish to peruse http://launchd.info which is a human-readable guide for writing, configuring, and maintaining launchd guides.

Setting up Launchd:

Please note: Before rolling out your PCClient.app launchd plist it is highly recommended that you test it on either a Mac OS VM, a dedicated testing workstation, or the Mac of a user who is a willing guinea pig.

Also, the supplied launchd plist is best suited for Macs that do not leave your network, i.e. iMacs, Mac Pros, and Mac Minis that are primarily stationary. If you are looking for a solution better suited to portable Macs like MacBooks, MacBook Airs, and MacBook Pros please see the advanced configuration section below.

Process

  1. Log in to the test Mac as user with Administrator access.

  2. Download our basic launchd plist here: PaperCut_LaunchD.zip This plist assumes that PCClient.app is stored in /Applications/, if this is not the case please skip to Advanced Configuration Options below.

  3. Copy the enclosed com.papercut.client.plist to /Library/LaunchAgents/

  4. Next we’ll be opening Terminal.app to verify the permissions are correct on the plist to ensure launchctl will be able to operate the plist. If you are unaccustomed to using Terminal you can copy and paste the following commands in.

    cd /Library/LaunchAgents/

    sudo chown root:wheel com.papercut.client.plist

    sudo chmod 644 com.papercut.client.plist

  5. Next we’ll verify that the permissions for the file are correct:

    ls -lah com.papercut.client.plist

    The output should look like:

    -rw-r--r--@ 1 root wheel 458B Jul 29 2014 com.papercut.client.plist

  6. Reboot the Mac to verify that the launchd job is functioning as expected, or in Terminal.app run the following:

    launchctl load /Library/LaunchAgents/com.papercut.client.plist

Advanced Configuration Options:

- Suggestions for MacBook Airs/MacBook Pros:

As these Macs are highly likely to encounter situations where they may be outside of the range of your PaperCut server it is highly recommended that you modify com.papercut.client.plist by replacing “KeepAlive” with “RunAtLoad” as this will open PCClient.app at the time of user login and allow for application closure. “KeepAlive” ensures that PCClient.app is always running.

  • If you encounter Java errors or PCClient.app errors out at launch you can replace the following in the com.papercut.client.plist

    <string>/Applications/PCClient.app/Contents/MacOS/JavaAppLauncher</string>

    with

    <string>open -g -W /Applications/PCClient.app/</string>

  • If PCClient.app is not stored under /Applications/ you can edit com.papercut.client.plist to reflect the appropriate path to PCClient.app by updating the following line

    <string>/Applications/PCClient.app/Contents/MacOS/JavaAppLauncher</string>

  • For environments with automated deployment and configuration using Munki, Casper or similar, see PaperCut Client Deployment using Mac Packaging & Deployment Tools.

M1 & Intel-based macOS - PCClient app greyed out:

We have reports on installation of the PCClient by an administrator on M1 & Intel-based macOS devices, additional steps may be required for users to successfully run the PCClient app.

  1. Copy the com.papercut.client.plist to the LaunchAgents folder (if you are using this) and PCClient.app to the Mac Applications folder as normal.

  2. Open Terminal:

    cd /Library/LaunchAgents/

    sudo chown root:wheel com.papercut.client.plist

    sudo chmod 644 com.papercut.client.plist

    xattr -cr /Applications/PCClient.app

    sudo chmod -R 755 /Applications/PCClient.app

    sudo xattr -dr com.apple.quarantine /Applications/PCClient.app

When run in that order, all accounts that log into that mac should now load the PaperCut Mac Client without any issues.

Launchd plist contents:

The above-linked .zip file contains com.papercut.client.plist, which is the following XML information:

 <?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>Label</key>
     <string>com.papercut.client.agent</string>
     <key>ProgramArguments</key>
     <array>
         <string>/Applications/PCClient.app/Contents/MacOS/JavaAppLauncher</string>
     </array>
     <key>KeepAlive</key>
     <true/>
 </dict>
 </plist>

Legacy Solutions:

The PaperCut Manual documents use of a Login Hook to start the user client. The Login Hook runs as root which allows pop-up authentication to be eliminated in some scenarios.

One disadvantage of the Login Hook approach is that only a single Login Hook may be defined. This may not be a great limitation as you can run multiple commands with a single Login Hook script. However, in some deployment situations other application installs may interfere with the Login Hook and an alternative startup mechanism may be sought.


Categories: How-to Articles , User Client


Keywords: launchd , client , login hook

Comments

Last updated March 15, 2024