I previously installed a really cringe-worthy app on impulse. It quickly turned out to be pretty much unusable. Even dragging it to the Trash failed, so I went straight to sudo and force-deleted the app. Then I manually parsed the .pkg and removed files one by one. TeamViewer, yes, that's the one.

A few days later, when checking the system log, I found it was still reporting TeamViewer launch failures. Only then did I remember I'd forgotten to remove the launchctl startup item.

launchctl startup items aren't complicated, and its documentation is quite detailed:

Bash
$ launchctl help

You can see the general usage.

Bash
$ launchctl list

Check the startup list. You can easily find the relevant content.

Bash
$ sudo launchctl remove com.teamviewer.teamviewer
$ sudo launchctl remove com.teamviewer.desktop

Then I easily cleaned it up.

In addition, there were still remnants left, so I also had to deal with /Library/LaunchAgent.

Bash
cd /Library/LaunchAgent
sudo rm -rf com.teamviewer.teamviewer.plist com.teamviewer.teamviewer_desktop.plist

By the way, for macOS it's best to stick with things from Homebrew or the App Store; anything beyond that, it's probably wise to be cautious. Personally, I only downloaded MPlayer. Carelessly grabbing some random external DMGs is simply torture for the soul.

Tip:

If you find startup items that can't be deleted, check: /Library/LaunchAgent, /Library/LaunchDeamon, and /Library/StartupItems — both the system-level and user-level versions.

Later I found that it also provides its own removal option; see here.

Reference:

Remove an Agent from launchd