Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
361 views
in Technique[技术] by (71.8m points)

Rails server says port already used, how to kill that process?

I'm on a mac, doing:

rails server

I get:

2010-12-17 12:35:15] INFO  WEBrick 1.3.1
[2010-12-17 12:35:15] INFO  ruby 1.8.7 (2010-08-16) [i686-darwin10.4.0]
[2010-12-17 12:35:15] WARN  TCPServer Error: Address already in use - bind(2)
Exiting

I know I can start one on a new port, but I want to kill this process.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Assuming you're looking to kill whatever is on port 3000 (which is what webrick normally uses), type this in your terminal to find out the PID of the process:

$ lsof -wni tcp:3000

Then, use the number in the PID column to kill the process:

$ kill -9 PID

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...