For Macintosh computers running OS X 10.7 and later, and most especially Mac OS 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.
- Log in to the test Mac as user with Administrator access.
- 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.
- Copy the enclosed com.papercut.client.plist to
- 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.
sudo chown root:wheel com.papercut.client.plist
sudo chmod 644 com.papercut.client.plist
- 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
- 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 MacBooks/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>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
- For environments with automated deployment and configuration using Munki, Casper or similar, see PaperCut Client Deployment using Mac Packaging & Deployment Tools.
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”>
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: User Client Tool, Apple Mac OS X
Keywords: launchd, client, login hook