Recently I stumbled upon same issue and found out following:
document.execCommand("copy")
works without any issue now in Safari.
If you have a specific use case of copy command not working only in safari, one of the things that you may want to check is if your copy command is being run inside an API callback or in some other similar asynchronous fashion. Also, copying in Safari will only work if it is coming from DOM event (console testing won't work).
For me, my text to be copied was coming from async call's response. I had to move API call outside of onClick to prefetch the text and then, only do the copying of that text when copy button is clicked. Worked!
Following code will work without any issue in Safari (given its directly written to DOM event handler like onClick):
var clipBoardElem = document.createElement("input");
document.body.appendChild(clipBoardElem);
clipBoardElem.value = "text";
clipBoardElem.select();
var successfulCopy = document.execCommand('copy');
Once done, you can remove temp elem:
document.body.removeChild(clipBoardElem)