wget on OS X

Discussion in 'Mac Programming' started by ScKaSx, Sep 11, 2007.

  1. ScKaSx macrumors regular

    Joined:
    Feb 27, 2006
    #1
    Hi All,

    Sorry for posting so many issues at once. Anyways, I compiled wget from source since it doesn't come native on osx and moved the binary to /usr/local/bin (and this is in my path).

    I'm trying to run a typical (PC) wget command:
    wget -q -O - ftp://ftp.mutt.org/mutt/devel/mutt-1.5.16.taar.gz | tar xvfz -

    However, I get the following error:
    " gzip: stdin: unexpected end of file
    tar: Child returned status 1
    tar: Error exit delayed from previous errors "

    Any clues on how I can fix this, or is my syntax somehow off for the wget command. Note: I have 10.4.9 and gzip is located in /usr/bin (don't think this makes a difference).

    Cheers,
    ScKaSx
     
  2. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #2
    Code:
    wget -q -O - ... | tar xvfz -
               ^                ^
    
    I'm probably missing something quite obvious, but what are the two floating hyphens for? It's not usual unix parlance to have a hyphen with no flag attached to it.
     
  3. itickings macrumors 6502a

    itickings

    Joined:
    Apr 14, 2007
    #3
    Does it work better if you use
    Code:
    wget -q -O - [url]ftp://ftp.mutt.org/mutt/devel/mutt-1.5.16.tar.gz[/url] | tar xvfz -
    instead?

    You can also try
    Code:
    curl ftp://ftp.mutt.org/mutt/devel/mutt-1.5.16.tar.gz | tar xvfz -
    Curl is included with OS X.

    Well, it's not really that uncommon to refer to stdin/stdout that way, is it?
     
  4. AlmostThere macrumors 6502a

    #4
    IIRC, it 'normally' indicates some expected input is coming from stdin.

    I have seen it in a few places used like this ... but no comment on standard-ness of it.
     
  5. emotion macrumors 68040

    emotion

    Joined:
    Mar 29, 2004
    Location:
    Manchester, UK
    #5
    Are you sure that command line is correct. This can happen when the file isn't really gzipped etc

    I use curl instead btw. 'curl -O url' is more or less the same as 'wget url'
     
  6. Nugget macrumors 65816

    Nugget

    Joined:
    Nov 24, 2002
    Location:
    Houston Texas USA
    #6
    This is a very common shorthand for "stdin" when dealing with Unix command line apps.
     
  7. ScKaSx thread starter macrumors regular

    Joined:
    Feb 27, 2006
    #7
    Hi all,

    Just an update, I'm an idiot. It works, I just typed the URL wrong. If you'll notice in my post I added an extra 'a' to the tar file. Sorry for wasting everyones time.

    Any ideas.

    Cheers,
    ScKaSx
     
  8. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #8
    LOL glad you got it figured out. :)

    And thanks for the education on stdin. I'd never seen that before.
     
  9. itickings macrumors 6502a

    itickings

    Joined:
    Apr 14, 2007
    #9
    Yeah, I noticed (as you can see in my previous reply), but I tried to be a bit nicer than calling you, as you phrased it, an idiot. ;)
     
  10. Nugget macrumors 65816

    Nugget

    Joined:
    Nov 24, 2002
    Location:
    Houston Texas USA

Share This Page