2025-01-21, 10:55 PM
Issue: if you run NextPVR by opening a terminal window (even if automated with a launchagent as previously posted):
These issues are resolved by using a launchagent or launchdaemon. The following are instructions on how to do it with a launchagent:
When the above is done, NextPVR will launch automatically when you log into your account. You can launch it by logging out and back in to your account. The keepalive key will keep NextPVR running even if it crashes, etc., until you shut it down manually (as detailed below) or you log out of your account.
You can also manually launch and stop NextPVR with the following terminal commands:
Notes and Limitations:
- you still have nextpvr running in a terminal window, even if the window is hidden
- if someone quits terminal, or if nextpvr crashes or is otherwise shut down, you will miss recordings until you detect and correct the problem.
These issues are resolved by using a launchagent or launchdaemon. The following are instructions on how to do it with a launchagent:
- unzip and copy the attached launchagent (org.nextpvr.backend.plist) into ~/library/launchagents
- set the owner to your username (the name of your home folder). This can be done with this terminal command: chown <username> ~/library/launchagents/org.nextpvr.backend.plist
- set the file permissions to 644: chmod 644 ~/library/launchagents/org.nextpvr.backend.plist
- this launchagent expects your NPVR folder to be in /applications (specifically, that the path to NextPVRServer.dll is /applications/npvr/NextPVRServer.dll). If you don't want it in /applications, or you want the folder named something other than NPVR, you can edit the launchagent WorkingDirectory and ProgramArguments accordingly, but I have not tested in another directory and there may be bumps due to macOS security issues that will cause the launchagent to fail.
When the above is done, NextPVR will launch automatically when you log into your account. You can launch it by logging out and back in to your account. The keepalive key will keep NextPVR running even if it crashes, etc., until you shut it down manually (as detailed below) or you log out of your account.
You can also manually launch and stop NextPVR with the following terminal commands:
- launchctl load ~/Library/Launchagents/org.nextpvr.backend.plist
- launchctl unload ~/Library/Launchagents/org.nextpvr.backend.plist
Notes and Limitations:
- A potentially significant limitation of using a launchagent instead of a launchdaemon is that a launchagent will require that a particular user be logged into the computer and stay logged in. Accordingly, booting up the computer is not enough to launch NextPVR and if, for whatever reason, the user is logged out or the computer restarts (power outage, for instance) NextPVR won't run until the user is logged in again. Also, if there is more than one user who uses the computer, NextPVR will only run when the user whose account has the launchagent is logged in. These limitations would be resolved by a launchdaemon, which has the same function as a launchagent, but runs system wide on boot up. Writing a launchdaemon that will work with NextPVR is more complicated (for me anyway) and I have not yet managed to get it to work. When I figure it out, I will update.
- You can see the purpose of each of the keys in the launchagent by checking the manual (in terminal "man launchd.plist", or just google "man launchd.plist".