# Ruby script/server -- Errno::EADDRINUSE

**URL:** <https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316>\
**Category:** Rails\
**Created:** [April 18, 2007, 7:52am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316 "2007-04-18T07:52:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [April 18, 2007, 7:52am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/1 "2007-04-18T07:52:49Z")

</div>

hi flocks,

plz help me…

when i am trying to start the server i am getting the following error  
the address is already binded plz help me to release the address…  
there are no such application which takes the this address… plz help  
me to release the address…

$ruby script/server  
=\> Booting WEBrick…  
=\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Ctrl-C to shutdown server; call with --help for options  
[2007-04-17 16:02:20] INFO WEBrick 1.3.1  
[2007-04-17 16:02:20] INFO ruby 1.8.6 (2007-03-13) [i686-linux]  
[2007-04-17 16:02:20] WARN TCPServer Error: Address already in use -  
bind(2)  
/usr/local/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from /usr/local/lib/ruby/1.8/webrick/utils.rb:73:in `new’  
from /usr/local/lib/ruby/1.8/webrick/utils.rb:73:in  
`create_listeners' from /usr/local/lib/ruby/1.8/webrick/utils.rb:70:in `each’  
from /usr/local/lib/ruby/1.8/webrick/utils.rb:70:in  
`create_listeners' from /usr/local/lib/ruby/1.8/webrick/server.rb:75:in `listen’  
from /usr/local/lib/ruby/1.8/webrick/server.rb:63:in  
`initialize' from /usr/local/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize’  
from  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick\_server.rb:58:in  
`new' ... 7 levels... from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem\_original\_require’  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require’  
from script/server:3

Thanks

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [April 24, 2007, 6:53am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/2 "2007-04-24T06:53:49Z")

</div>

rookie to RoR here and also experiencing errors with

$ruby script/server

When I execute the above command, instead of WEBrick starting up, I get  
an error message:

./script/…/config/boot.rb:29: undefined method ‘gem’ for main:Object  
(NoMethodError) from script/server:2

I have ruby 1.8.4 installed, rubygems 0.8.11, and Rails 1.2.3

I was also pleased to get MySQL running so easily on LINUX (this is  
SUSE Enterprise Desktop 10 from Novell).

I could probably find another way to start up WEBrick, but I prefer to  
use the above command.

Note: This “ruby script/server” command was performed from a directory  
named “shovell” that was created using the “rails shovell” command from  
my home  
directory, and it appears that the associated Rails application  
directories  
were cleanly created by “rails shovell”. This is discussed in Lenz’  
book on RoR Web Applications.

Greatly appreciate in advance your valuable time in reading this and any  
assistance you can give.

Regards,  
ambulance\_driver

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [April 24, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/3 "2007-04-24T15:27:13Z")

</div>

A follow-up on the above notion that a different application server  
might  
make a difference.

After installing Mongrel, and starting up the Mongrel application server  
with:

sudo mongrel\_rails start -p 3000

(Above command land parameter “-p” specifieds start on port 3000)

I receive the following messages:

\*\*Starting Mongrel listening at 0.0.0.0:3000  
\*\*Starting Rails with development environment…  
/root/shovell/config/boot.rb:29: undefined method ‘gem’ for main:Object  
(NoMethodError)

…many messages forward from this point…

The above message error is the same for what I received when trying  
“ruby script/server” to start up the WEBrick server, so I guess on my  
part is that  
I have some kind of environmental problem on my LINUX distribution.

Comments? Suggestions?

-ambulance\_driver

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [April 24, 2007, 7:32pm UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/4 "2007-04-24T19:32:39Z")

</div>

On Apr 24, 2007, at 12:53 AM, Greg Neely wrote:

> (NoMethodError) from script/server:2
> 
> I have ruby 1.8.4 installed, rubygems 0.8.11, and Rails 1.2.3

Update your rubygems to \>= 0.9.0

sudo gem update --system

> my home  
> ambulance\_driver  
> -Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [April 25, 2007, 3:09am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/5 "2007-04-25T03:09:17Z")

</div>

Rob B. wrote:

> On Apr 24, 2007, at 12:53 AM, Greg Neely wrote:
> 
> > (NoMethodError) from script/server:2
> > 
> > I have ruby 1.8.4 installed, rubygems 0.8.11, and Rails 1.2.3
> 
> Update your rubygems to \>= 0.9.0
> 
> sudo gem update --system
> 
> > my home  
> > ambulance\_driver  
> > -Rob
> 
> Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
> removed\_email\_address@domain.invalid

Rob,

As we say in EMS, a.k.a. “Emergency Medical Services”, a.k.a. “Earns  
Money Sleeping”, U-DA-MAN…🙂

The command as root: gem update --system

configured rubygems to 0.9.2. At that point, I tried:

cd /shovell (a rails application directory)

followed by the previous “bad actor”:

ruby script/server

Mongrel booted beautifully, and:

[http://0.0.0:3000](http://0.0.0:3000)

took me to the Welcome Aboard page for Rails.

Many thanks, Rob!

To return the favor, I have a small RUBY program below to read some  
data from a flat file.  
#!/usr/bin/ruby  
buffer\_as\_array=IO.readlines(“testfile”)  
lines=buffer\_as\_array.size  
print “myfile has #{lines} lines in it.\n”  
for x in buffer\_as\_array do  
str=x.chomp!  
t,v,d,q = str.split(" ")  
print “#{t} #{v} #{d} #{q}\n”  
end

Try to use the same blank delimited data and read it into objects using  
Apple’s Objective-C in the XCode IDE, and the same functionality will  
cost  
you many more loc. LOL.

Onward and upward with Java and Ruby,  
ambulance\_driver (Greg Neely, M.S., NREMT-B)

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [December 7, 2009, 6:17am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/6 "2009-12-07T06:17:03Z")

</div>

Hi !!  
I also faced the same problem.

I tried doing this :

=\>ruby gem update --system

after that I started server using

=\>ruby script/server

and It worked properly.

U do try this 🙂

thanks

Subodh D. Choure

thamu … wrote:

> hi flocks,
> 
> plz help me…
> 
> when i am trying to start the server i am getting the following error  
> the address is already binded plz help me to release the address…  
> there are no such application which takes the this address… plz help  
> me to release the address…
> 
> $ruby script/server  
> =\> Booting WEBrick…  
> =\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
> =\> Ctrl-C to shutdown server; call with --help for options  
> [2007-04-17 16:02:20] INFO WEBrick 1.3.1  
> [2007-04-17 16:02:20] INFO ruby 1.8.6 (2007-03-13) [i686-linux]  
> [2007-04-17 16:02:20] WARN TCPServer Error: Address already in use -  
> bind(2)  
> /usr/local/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from /usr/local/lib/ruby/1.8/webrick/utils.rb:73:in `new’  
> from /usr/local/lib/ruby/1.8/webrick/utils.rb:73:in  
> `create_listeners' from /usr/local/lib/ruby/1.8/webrick/utils.rb:70:in `each’  
> from /usr/local/lib/ruby/1.8/webrick/utils.rb:70:in  
> `create_listeners' from /usr/local/lib/ruby/1.8/webrick/server.rb:75:in `listen’  
> from /usr/local/lib/ruby/1.8/webrick/server.rb:63:in  
> `initialize' from /usr/local/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize’  
> from  
> /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick\_server.rb:58:in  
> `new' ... 7 levels... from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem\_original\_require’  
> from  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `require’  
> from script/server:3
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![thameem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@thameem](https://www.ruby-forum.com/u/thameem)\
**Post date:** [December 7, 2009, 6:40am UTC](https://www.ruby-forum.com/t/ruby-script-server-errno-eaddrinuse/92316/7 "2009-12-07T06:40:13Z")

</div>

Hi Greg Neely

> I have ruby 1.8.4 installed, rubygems 0.8.11, and Rails 1.2.3

Any special need you use these much old versions? My suggestion is to  
upgrade to the latest versions (Rails is now 2.3.5 You can use Ruby  
either 1.8.6 or 1.8.7)

Sijo
