If you want to execute a long-running task on a machine, use
It even works on a Mac.
Start by typing
You’ll see this:
Now start your long-running task:
ctrl a + d will return you to your previous session.
screen -r will return you to the session again: