EventMachine: "`start_tcp_server': no acceptor (port is in use or requires root privileges)"

Had the same problem.

Ran lsof -i :3000 (3000 is the port I ran it on).

I found out that the port was being used by ruby. I killed the process using kill -9 *pid*.

When I ran lsof -i :3000 again, nothing showed up.

I then ran rails s and everything works fine now.


It happens when you didn't stop your server correctly, for example when suspended with Ctrl+Z or running the server twice.

If stopped by Ctrl+Z, this works for me:

Get the running process with:

$ ps ax | grep rails
18192 pts/28 Sl+  0:05 /home/admin/.rvm/rubies/ruby-2.1.2/bin/ruby bin/rails c
20496 pts/23 Tl 0:08 /home/admin/.rvm/rubies/ruby-2.1.2/bin/ruby bin/rails s
20919 pts/23 S+ 0:00 grep --color=auto rails

And then kill the process in which rails server running:

$ kill 20496

If it's not closed after a few seconds you can try to "force" close with with -9 (but this prevents any cleanup from Rails):

$ kill -9 20496

Now you can start the server again:

$ rails s

I have finally figured it out: it was actually the IP address I was binding to that was incorrect!

So essentially it is a very misleading error message, and if you get it, check the IP address too.