Printopia (AirPrint): turn it on/off via command line

airprintcommand line

I love Printopia – this allows my iDevices to print to a printer attached to my Mac. The problem is I usually don't leave it on all the time. Whenever I want to print from my phone, I'd turn it on via System Preferences app.

Question: is it possible to do so via command line? This way I can ssh in my Mac and turn it on/off (or even better, write some simple script to automate the process).

Best Answer

There's no real reason that I can think of not to leave it on all of the time, but you can easily turn it on and off by loading or unloading the launchd plist:

This will turn it on:

launchctl load ~/Library/LaunchAgents/com.ecamm.printopia.plist

This will turn it off:

launchctl unload ~/Library/LaunchAgents/com.ecamm.printopia.plist

Or you could just run the server directly:

/Library/PreferencePanes/Printopia.prefPane/Contents/MacOS/Printopia Server.app/Contents/MacOS/Printopia Server

(that's all one line)