Needed to escape the ~ when replacing $HOME with ~