Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Rails Application

Charles-Eric Legras
Charles-Eric Legras
4,917 Points

Localhost:3000 - not available

When I launch bin/rails server

I have this message:

[2015-02-16 17:43:38] INFO WEBrick 1.3.1 [2015-02-16 17:43:38] INFO ruby 2.0.0 (2014-05-08) [universal.x86_64-darwin14] [2015-02-16 17:43:38] WARN TCPServer Error: Address already in use - bind(2) Exiting /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/utils.rb:85:in initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/utils.rb:85:innew' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/utils.rb:85:in block in create_listeners' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/utils.rb:82:ineach' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/utils.rb:82:in create_listeners' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/server.rb:132:inlisten' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/server.rb:113:in initialize' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/httpserver.rb:45:ininitialize' from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in new' from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:inrun' from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in start' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/commands/server.rb:84:instart' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in block in <top (required)>' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:intap' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in <top (required)>' from bin/rails:4:inrequire' from bin/rails:4:in `<main>'

I don't understand why, because I worked when I install the testapp...

Please help

3 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 46,109 Points

Hi Charles-Erik

It looks like you're running another app on the same port (localhost:3000). You can only run one app per port, so you'll have to shut down the server for the other app.

Jennifer Crawshaw
Jennifer Crawshaw
17,878 Points

I am having this issue as well, but I do not have any other apps running on that port, they are all shut down. Any suggestions?

Andrew Smith
Andrew Smith
14,330 Points

This discussion is a bit old now, but I ran into the same problem today, seemingly out of the blue.

In the OSX console:

lsof -i tcp:3000

Find the port ID (PID) under the resulting listing, then:

kill -9 <PID>

Where PID is the port ID you obtained from running the "lsof" command above. Worked like a charm. Not sure if this syntax would work for Linux or Windows consoles.

I found this solution from Stackoverflow: http://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac

Charles-Eric Legras
Charles-Eric Legras
4,917 Points

Thank you Clayton !!! You were right !!! :)