$ pm2 startup
[PM2] You have to run this command as root. Execute the following command:
sudo su -c "env PATH=$PATH:/usr/local/bin pm2 startup darwin -u tanel"
$ sudo su -c "env PATH=$PATH:/usr/local/bin pm2 startup darwin -u tanel"
Password: *****
su: illegal option -- c
usage: su [-] [-flm] [login [args]]
Seems like the SU command on OSX no longer supports the -c switch.
Just sudo pm2 startup.
If MacOS == darwin then it's got a bug:
$ pm2 startup darwin
[PM2] You have to run this command as root. Execute the following command:
sudo su -c "env PATH=$PATH:/Users/collumj/.nvm/versions/node/v4.2.0/bin pm2 startup darwin -u collumj --hp /Users/collumj"
collumj@por-collumj-m ~/work/projects-akmak/serd-inspection-processor (master) 15:36:11
$ sudo su -c "env PATH=$PATH:/Users/collumj/.nvm/versions/node/v4.2.0/bin pm2 startup darwin -u collumj --hp /Users/collumj"
su: illegal option -- c
usage: su [-] [-flm] [login [args]]
I have the same problem as jcollum
Running it with sudo (sudo pm2 startup darwin) worked. The generated command from pm2 startup darwin still appears to have a bug though.
This could use a fix. The output from pm2 startup darwin without sudo is too confusing.
https://github.com/Unitech/pm2/issues/2559
$ pm2 startup launchd
Most helpful comment
Just
sudo pm2 startup.