# macOS: Troubleshooting the Print Client

<p class="callout success">****UPDATE:**** <span style="white-space: pre-wrap;">The </span>[macOS version of the Support Tool](https://kb.simplerfid.com/books/support-tool/chapter/support-tool-mac)<span style="white-space: pre-wrap;"> has been released, which provides quick access to Refresh and Repair functions. In most cases you should use the Support Tool rather than the commands below.</span></p>

### Introduction

The macOS Print Client is currently in beta. As such, it has a couple of known issues:

- The print client will not run if certain USB storage devices are plugged into the Mac
- The print client does not support Printronix printers via USB; use a network connection

### Troubleshooting

The following commands can be copy/pasted into Terminal to take action on the print client.

<p class="callout info"><span style="white-space: pre-wrap;">These commands require Administrator access to the Mac. When using sudo, you'll periodically be prompted for your password in order to escalate your privileges. These commands can also be used in a root shell by omitting </span>`<span class="editor-theme-code">sudo</span>`.</p>

<p class="callout danger">****As always, please exercise caution when using the terminal, especially with elevated privileges. Make sure you fully understand any command you're using, otherwise you may damage your system.****</p>

##### Get ClientId from PrintClientDatabase

The ClientId is the station's unique identifier when communicating with our servers. This value can be useful for identifying a station when troubleshooting.

```bash
sudo sqlite3 /var/root/Library/Application\ Support/Simple\ RFID/PrintClient/PrintClientDatabase.db "SELECT ClientId from RegistrationData"
```

##### Refresh Print Client

```bash
sudo launchctl kickstart -k system/com.simplerfid.printclient
```

<span style="white-space: pre-wrap;">The print client (and its updater) are handled as services by launchd in macOS. The above command instructs launchd to refresh the print client by "kickstarting" the process, with </span>`<span class="editor-theme-code">-k</span>`<span style="white-space: pre-wrap;"> indicating that the process should be killed if it is already running.</span>

<span style="white-space: pre-wrap;">If you receive the error </span>`<span class="editor-theme-code">Could not find service "com.simplerfid.printclient" in domain for system</span>`, the print client is not installed, or has been manually disabled. Install or re-enable the print client to continue.

##### Disable Print Client

```bash
sudo launchctl bootout system/com.simplerfid.printclient
sudo launchctl bootout system/com.simplerfid.printclient.update
sudo launchctl bootout system/com.simplerfid.printclient.updater.selfupdate
```

These three commands stop the print client and its updater processes, and unload the services from the system domain. This will prevent the print client from starting or updating automatically.

While not recommended, these commands can also be used independently of each other to control specific components.

##### Re-enable Print Client

```bash
sudo launchctl bootstrap system /Library/LaunchDaemons/com.simplerfid.printclient.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/com.simplerfid.printclient.update.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/com.simplerfid.printclient.updater.selfupdate.plist
```

These three commands load the print client and updater services back into the system domain, effectively re-enabling them all. Since these services are not currently in the domain, we provide the full path to each service's plist.

After this is complete, launchd will continue launching these services automatically on their respective intervals.

##### Run Print Client manually

```bash
(cd "$(printf '%s\n' /Applications/SimpleRfid/PrintClient.[0-9]* | sort -V | tail -n1)" && ./SimpleRFID.PrintClient)
```

<span style="white-space: pre-wrap;">The parentheses start a subshell where we temporarily </span>`<span class="editor-theme-code">cd</span>`<span style="white-space: pre-wrap;"> into the target directory, run the command, and then automatically return to the original directory when the subshell exits.</span>

The print client should function exactly the same as if it was started by launchd, except you may be able to see some output from the application, for troubleshooting purposes. If you close the terminal window or press Ctrl-C, the process will terminate.

##### Uninstall Print Client

```bash
: # Unload the services from the system domain
sudo launchctl bootout system/com.simplerfid.printclient
sudo launchctl bootout system/com.simplerfid.printclient.update
sudo launchctl bootout system/com.simplerfid.printclient.updater.selfupdate

: # Delete the plist files defining the services
sudo rm -f /Library/LaunchDaemons/com.simplerfid.printclient.plist
sudo rm -f /Library/LaunchDaemons/com.simplerfid.printclient.update.plist
sudo rm -f /Library/LaunchDaemons/com.simplerfid.printclient.updater.selfupdate.plist

: # Delete the SimpleRfid folder in /Applications containing the print client and updater
sudo rm -rf /Applications/SimpleRfid

: # Delete temporary files
sudo rm -rf "/tmp/Simple RFID"

: # Delete the receipts for previous installs
pkgutil --pkgs | grep com.simplerfid.printclient.updater | xargs -n1 sudo pkgutil --forget

: # OPTIONAL: Delete the Application Support data for the print client
: ## This will require you to contact support to re-attach the station to your
: ## account if you reinstall the print client in the future.
sudo rm -rf "/var/root/Library/Application Support/Simple RFID"
```

<span style="white-space: pre-wrap;">These commands should remove any trace of the print client from your system. You can always install the print client again using the installer from the </span>[Resources](https://portal.simplerfid.com/resources)<span style="white-space: pre-wrap;"> page on the web portal.</span>

##### Download and install Print Client via command line

```bash
: # Download the latest installer from GitHub
curl -L0 -o /tmp/PrintClient.Updater.arm64.pkg https://github.com/simplerfid/printclient-updater/releases/latest/download/PrintClient.Updater.arm64.pkg

: # Run the installer
sudo installer -pkg /tmp/PrintClient.Updater.arm64.pkg -target /
```

These commands download the latest installer and run it from the command line with no GUI.

<span style="white-space: pre-wrap;">Depending on your internet speed, your terminal may sit for a while at </span>`<span class="editor-theme-code">installer: Installing at base path /</span>`<span style="white-space: pre-wrap;"> while the updater downloads the latest print client files. When the process is complete, you should see </span>`<span class="editor-theme-code">installer: The install was successful.</span>`