I don't have a mac, but this is pure unix and should be applicable to
you as well.

Get the PID of the server process and kill it manually:
$ ps aux |grep ruby
hgimenez 30736 24.8  1.6  48772 33252 pts/0    Sl+  11:22   0:03 ruby
script/server
hgimenez 30802  0.0  0.0   4204   704 pts/1    S+   11:22   0:00 grep
ruby
$

In my case, you want to kill process 30736. Same thing could be
achieved with pgrep:

$ pgrep ruby
30736
$

But if you have many ruby processes going on, you won't know which one
to kill.

Now that you have the process ID, kill it:

$ kill 30736
$

The server should be gone, and you should be able to start the server
again on the same port:
$ ps auxwww |grep ruby
$ script/server [...]

Hope that helps,
-Harold

On May 3, 7:48 am, 7stud -- <rails-mailing-l...@andreas-s.net> wrote:
> In macvim, I started the server like this:
>
> :Rserver
>
> But I'm trying to debug something in my application, and I want to use
> puts to output a message in the server's output window.  Before
> installing macvim and rails.vim, I kept a Terminal window open where I
> started the server using:
>
> /myapp$ruby script/server
>
> and the server(Mongrel) would log output to the window about what it was
> doing.  Then if I used puts in my program, the output would go to the
> server window, and I could examine it.
>
> I want to set up a separate Terminal window for the sever like before,
> so I can examine the server's output, but I can't figure out how to kill
> the server I started in macvim/rails.vim.  If I try to start a server in
> Terminal, I get an "address already in use" error:
>
> /myap$ ruby script/server
> => Booting Mongrel
> => Rails 2.3.2 application starting onhttp://0.0.0.0:3000
> => Call with -d to detach
> => Ctrl-C to shutdown server
> Exiting
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in
> `initialize_without_backlog': Address already in use - bind(2)
> (Errno::EADDRINUSE)
>
> I tried closing every macvim and Terminal window, quitting the macvim
> and Terminal programs, and shutting down Firefox, then relaunching
> Terminal.  But I when I open a Terminal window and try to start the
> server using:
>
> /myapp$ ruby script/server
>
> I get the same error message: "address already in use".  Here is what
> the top command produces:
>
> $ top
> -----------
>   PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE
> VSIZE
>  1200 top          6.9%  0:06.71   1    18    20   544K   428K  1.01M
> 27.0M
>  1195 bash         0.0%  0:00.01   1    14    16   220K   824K   804K
> 27.1M
>  1194 login        0.0%  0:00.00   1    16    40   172K   508K   660K
> 26.9M
>  1192 Terminal     1.0%  0:02.26   4    90   142  1.99M  10.7M+ 8.01M+
> 231M+
>  1167 ruby         0.1%  0:04.17   2    10   132  20.3M  2.59M  21.7M
> 50.4M
>  1141 lookupd      0.0%  0:00.19   2    34    38   464K  1.02M  1.26M
> 28.5M
>  1138 MDCPdUSB     0.0%  0:00.01   1    23    20   312K   772K   996K
> 27.1M
>  1136 pppd         0.0%  0:00.04   1    26    30   332K  1.02M  1.43M
> 27.4M
>  1130 mdimport     0.0%  0:00.33   4    65    56  1.23M  3.67M  4.08M
> 39.7M
>   357 Preview      0.0%  0:00.36   1    69   118  1.73M  7.95M  6.29M
> 225M
>   217 AppleSpell   0.0%  0:01.45   1    44    34   700K  3.18M  2.37M
> 37.8M
>   214 Safari       0.0% 29:11.21   9   298  3311   407M  52.6M   323M
> 700M
>   207 automount    0.0%  0:00.01   3    39    30   308K   924K  1.09M
> 28.7M
>   203 automount    0.0%  0:00.01   3    41    34   316K   956K  1.13M
> 29.0M
>   200 rpc.lockd    0.0%  0:00.00   1    10    17   124K   452K   220K
> 26.7M
>   191 nfsiod       0.0%  0:00.00   5    30    24   124K   352K   208K
> 28.6M
>
> -------------
>
> That ruby process looks suspicious.  I don't know what that is.
>
> Currently, the only way that I can kill the server is to reboot my
> computer, which is not very convenient.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to