Chosen Solution

I recently updated my old MacBook Pro with a new battery, 8gb of RAM, 3G SSD, and hard drive cable. Did a fresh OS instal on the SSD and ran it externally as the boot drive for a week. Everything was great so I installed it into the laptop and immediately started having problems. Sometimes it doesn’t want to boot, gets half way then just shuts down. Sometimes I can boot to safe mode then get it to restart and load the system all the way. Once the OS loads sometimes I can start working and all is well until the computer goes to sleep then waking from sleep the computer freezes, spinning rainbow and has to be hard reset. Other times the OS will load then give me a error message “Unapproved caller. SecurityAgent may only be invoked by Apple software.” I cant do anything but hard reset. Reseting the PRAM and SMC doesn’t seam to have an effect. Looking up these issues I saw many people pointing to the hard drive cable being the cause. So I changed that out with one from IFIXIT and the exact same problem is still happening. I took the SSD out of the laptop and put the original hard drive back in and everything runs great. So then I went back to booting the SSD externally and it runs great. So I only experience problems when the SSD is installed in the laptop. Not sure what to try next. Any help figuring this out would be very appreciated.

I suspect the format on your new drive. While a drive does not need to be formatted for Mac to boot from it externally, it has to be a Mac format to boot from internally. Now as to which format, if you stayed with Sierra or below, formatting GUID Mac OS X Extended is fine. If you pushed it to High Sierra it may try to imposed APSF formatting, (which I really don’t care for on none Apple drives. So what did you install?

If you go through this guide do you see any abnormal results? How to determine Mac shutdown causes

I will suggest you to copy the important files and reinstall the MacOS from the recovery partition.What brand of SSD did you purchase.