Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnthony Ho
10,228 PointsCan't start the rails server
Shows an error
[2014-10-13 12:46:24] INFO WEBrick 1.3.1
[2014-10-13 12:46:24] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
Exiting
/Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:206:in `bind': Address already in use - bind(2) for 0.0.0.0:3000 (Errno::EADDRINUSE)
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:206:in `listen'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:461:in `block in tcp_server_sockets'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:232:in `each'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:232:in `foreach'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/socket.rb:459:in `tcp_server_sockets'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/utils.rb:75:in `create_listeners'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:132:in `listen'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:113:in `initialize'
from /Users/AnthonyHo/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:45:in `initialize'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `new'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `run'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/railties-4.0.1/lib/rails/commands/server.rb:84:in `start'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/railties-4.0.1/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/railties-4.0.1/lib/rails/commands.rb:71:in `tap'
from /Users/AnthonyHo/.rvm/gems/ruby-2.1.2/gems/railties-4.0.1/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Anthony Ho
10,228 PointsHow do I stop other instances?
Sreng Hong
15,083 Pointsi think it's control + c to close the rails server.
Daniel Reedy
25,284 PointsIf you have access to the terminal window that the rails server is running then you can press control+C. If, however, you closed the window but the server is still running you will have to find the process and kill.
From the terminal you can run ps aux | grep rails
which will list any running process that matches rails. You'll see an output such as
6443 ttys013 0:00.00 grep rails
5546 ttys014 0:04.52 ruby bin/rails server
In this example, the second entry is the server process. You can then pass the kill
command the process ID to terminate the server. In our example the command would be kill 5546
.
Anthony Ho
10,228 PointsI'm trying to start the rails server. I typed bin/rail server
and it doesn't work
I still have this problem
2 Answers
Daniel Cardenas
Courses Plus Student 9,236 PointsTry this...
Type this in your terminal to find out the PID of the process that's using the 3000 port:
'lsof -wni tcp:3000'
Then, use the number in the PID column to kill the process:
'kill -9 PID'
Make sure you substitute PID with the actual number that you see under the PID for example 'kill -9 11734'
Hopefully that works.
Anthony Ho
10,228 PointsSorry that didn't work
Daniel Cardenas
Courses Plus Student 9,236 PointsSorry Anthony.
Anthony Ho
10,228 PointsIt's okay I rebooted the terminal and it's fine now
Daniel Reedy
25,284 PointsDaniel Reedy
25,284 PointsThe error message
Address already in use - bind(2) for 0.0.0.0:3000 (Errno::EADDRINUSE)
is showing that you already have an instance of a web server running elsewhere, perhaps in another terminal tab.Make sure you have stopped any other instances of
rails server
and try again.