Upgrading/updating Home Assistant with a script

As a follow up on my post above for Mac users that found this post, what I posted didn’t work reliably so I iterated to the following which seems to work. Of note to what the OP achieved, this just upgrades to the available next version.

update_ha: 'ssh -i /Users/username/.homeassistant/keyfile [email protected] "nohup /Users/username/.homeassistant/www/scripts/update_ha.sh > /Users/username/.homeassistant/www/scripts/update_ha.out 2>&1 &"'
#!/bin/bash

launchctl bootout gui/<uid> '/Users/username/Library/LaunchAgents/org.homeassistant.plist' ;
/Users/username/homeassistant/bin/pip3 install --upgrade homeassistant &&
launchctl bootstrap gui/<uid> '/Users/username/Library/LaunchAgents/org.homeassistant.plist'