Friday, October 29, 2021

[SOLVED] Nohup does not work in OSX

Issue

Bash:

$nohup sleep 10 &

but when I close the terminal:

will exit warning

Any ideas? ideally I want to run Mongodb in the background.


Solution

Interesting. Seems like an issue specific to the default Terminal app. Because for what it's worth, iTerm2 doesn't exhibit this behavior. (so in other words, nohup is not actually broken on OS X; this just seems like special behavior in Terminal which looks for subprocesses on exit.)

In many ways, iTerm2 it's better than the default terminal. You should give it a try!



Answered By - mpontillo