If you spot an uptick in online activity, or note that your child seems increasingly or emotionally preoccupied with their phone or computer, it could be a warning sign. If you do need to check your child's online account, but don't have a prior agreement where your child knows you might do so, it's usually best to discuss your concerns and plans with them beforehand (or immediately afterward, if the situation is truly urgent).
In order to find out about a possible threat in time, install the mac keylogger www.refog.com/mac-keylogger.html
Express to your child why you feel or felt it was necessary to take action, and involve them in figuring out what to do next.