Cronjob macOS does not work if set with a bash external script
There is no need to check whether there currently is a crontab installed or not. Just run
(crontab -l 2&gt;/dev/null; echo '@reboot bash /Users/user/myscript.sh') | crontab -

to add the @reboot line to your crontab (or create a new one).