Skip to content
Advertisement

how do I kill a port in use — eventmachine

I get the following error:

eventmachine.rb:534:in `start_tcp_server': no acceptor (port is in use or requires root privileges)

I’m not sure what the process or port is and want to kill it so I can run my script again.

How do I do that?

Advertisement

Answer

ps ax | grep ruby
kill -9 [pid]

Example:

ps ax | grep ruby
#=> 857 pts/19     Sl+    0:04 /home/andreydeineko/.rvm/rubies/ruby-2.2.3/bin/ruby bin/rails server
#=> 14639 pts/18   S+     0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn rails
#=> 25368 pts/17   Sl+    0:02 /home/andreydeineko/.rvm/rubies/ruby-2.2.3/bin/ruby bin/rails c
kill -9 857
ps ax | grep ruby
#=> 14639 pts/18   S+     0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn rails
#=> 25368 pts/17   Sl+    0:02 /home/andreydeineko/.rvm/rubies/ruby-2.2.3/bin/ruby bin/rails c
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement