Sinatra and Shotgun, problems with port 9393 in use

Mohammad Khan
1 min readMar 12, 2018

One of my class mates was working on a Sinatra lab, but was unable to get shotgun working, as it would return the error that port 9393 was in use.

eventmachine-1.2.5/lib/eventmachine.rb:530:in `start_tcp_server’: no acceptor (port is in use or requires root privileges) (RuntimeError)

*Note :Shotgun is a ruby gem that allows a dev to make changes to their files without having to restart their stack. You can make a change and reload your browser page and have the new data changes available.

Looked at terminal and shotgun was not running. We also quit Atom since classmate was using the built in terminal in atom extension. Still errors.

Nothing appeared to be running shotgun. I suggested that we reboot the mac, but classmate would prefer not to. Then we found this solution on stack overflow: https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac

lsof -i :9393

remember *replace <PID> with number returned by lsof, example 18902

ps ax | grep <PID>

kill -QUIT <PID>

We ran shotgun and then it worked!

Great news.

--

--