Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Perl LWP modules and UNIX 'head' file UNIX
The LWP suite of Perl modules and applications is a popular choice for developing powerful automated web clients in Perl. However, if you install it under Mac OS X, it could make a dangerous change to your system (if Mac OS X is installed on an HFS+ file system).

LWP creates an executable program called /usr/bin/HEAD. Because the file system is case-insensitive, this ends up replacing the essential Unix utility called /usr/bin/head. After you install LWP, you can rename /usr/bin/HEAD to /usr/bin/HEAD_LWP, and copy /usr/bin/head from your Mac OS X install CD. I learned about this problem from:

- Brian
  • Currently 1.50 / 5
  You rated: 1 / 5 (4 votes cast)

Perl LWP modules and UNIX 'head' file | 9 comments | Create New Account
Click here to return to the 'Perl LWP modules and UNIX 'head' file' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
head restoration
Authored by: hmelton on Jun 04, '01 02:08:57PM

I did the very same thing a few weeks ago. I then went to the Darwin site and downloaded the source file for head, and recompiled a fresh copy. It is handy having the source freely available.

[ Reply to This | # ]
head restoration
Authored by: babbage on Jun 04, '01 03:18:03PM

This also came up on the mailing list, and somebody pointed out that,
if any of the applications such as "head" gets damaged by an install, you can simply
grab a clean copy off your installation discs. I'm not sure where it is on there, but
if you installed it once then surely you can install it again. No download necessary.

[ Reply to This | # ]
head restoration
Authored by: moyashi on Jun 04, '01 09:51:08PM

ok, where did you find this ??? search a lot of different places and can't seem to find the link you're talking about.


[ Reply to This | # ]
head restoration
Authored by: hmelton on Jun 05, '01 09:52:02AM

The source code for head can be found by going to
and downloading the text_cmds package. (tar.gz file) Make sure you have the
developer stuff installed and use the make command in the head folder.

Delete /usr/bin/HEAD ( this is an exact duplicate of GET,POST, and lwp-request so nothing is lost)
copy head to /usr/bin as root or using sudo and make the ownership and permissions the same as tail.

[melton-henry-1:/usr/bin] rhca80% sudo chown root head
[melton-henry-1:/usr/bin] rhca80% sudo chmod 555 head
[melton-henry-1:/usr/bin] rhca80% sudo chgrp wheel head
[melton-henry-1:/usr/bin] rhca80% ls -al head tail
-r-xr-xr-x 1 root wheel 14244 Apr 19 09:54 head
-r-xr-xr-x 1 root wheel 18232 May 10 08:24 tail

[ Reply to This | # ]
go figure ...
Authored by: moyashi on Jun 04, '01 08:23:52PM

ummm ... sort of disappointing that apple wouldn't be thinking this far ahead.

also, makes you wonder if os x server doesn't have smiliar problems.

the system not being case sensitive is nice for lazy people like me but I'm starting to re-think that hitting the shift key to get a capital letter wouldn't be that bad.

hope this problem get's cleared up on the next build....

heh ... might explain some of the crashes I get with a perl based script that intergrates with mysql.

[ Reply to This | # ]
go figure ...
Authored by: hmelton on Jun 05, '01 10:03:41AM

I hesitate to think of this as an Apple problem. It is more
nearly a lapse on the part of the LWP developers. Old traditional
unix file systems were case sensitive, but unix has developed
far beyond one file system and needs to be able to work on any kind
of file system that comes along (Mac HFS+, FAT, etc), and case folding
is more common than not. The idea that a new command could co-exist
with a 30 year old traditional command in the same bin directory simply
by making it upper case is clearly a mistake.

[ Reply to This | # ]
go figure ...
Authored by: babbage on Jun 05, '01 10:24:31AM

Well, to be fair, this is an intricate, legacy issue. If you install OSX on a unix formatted
filesystem (UFS?), then this issue probably won't come up. On the other hand, if you are
using a Mac filesystem (HFS or (I think) HFS+) then the filesystem is case insensitive, and
problems like this will matter. It's not that they didn't think of this, but that the
problem is more or less intractable.

If case sensitivity is going to be a big issue for you, then you should install onto a fresh,
clean, unix formatted disc partition -- but there's a possibilty (I may be wrong on this detail)
that doing so will keep you from being able to run Classic applications, and it could also
make it impossible to boot into OS9. If you want to keep OS9, then you have to keep HFS and
you lose case sensitivity, and problems like this may come up from time to time. The ideal
solution would be to go with more than one partition, with one as UFS so that OSX can run
"natively" and you don't hit these sorts of problem, and another HFS partition that can store
OS9 and its applications natively.

In any event, this isn't something that can be fixed by any upcoming build. If you want the
problem to go away, it probably has to be resolved at the underlying filesystem's level,
which means that you may have to do a clean and pre-planned install in order to handle it.
Short of that, it's just something you have to live with & plan for. That or get a second hard
drive & set it up to complement whatever you already have installed.

On the upside, Unixy things like Perl modules tend to be open source, so if you want you can
read over the source code & see if something you're installing might trample over something
you already have installed. If you know what you're doing, you may be able to adjust such
installs in order to prevent them from doing any damage. Failing that, you can always recover
any corrupted system utilities (like "head") from the installation discs that came with OSX.

[ Reply to This | # ]
go figure ...
Authored by: moyashi on Jun 05, '01 12:20:15PM

wooooooo ...

hehe, you guys sure know your stuff. I'm still a newbie and comments like yours at least helped me learn something again today :-)

I guess what I was thinking was that newbies like me who go along and mess with their system will come across things like this more often than not from now on. And having watched Apple play with *nix in the past just made me wonder why some of the mistakes and system meltdowns that will happen a little easier to recognize. hmmmm

IF it wasn't for your post I would have never realized that I've created a potential booby trap of a sort. This tad of information definately wil probaly have saved me a night's rest somewhere down the road. Thank you!!!

BTW, what would have been the possible case scenerio here?

PS ... thanks for the links and information above :-)

[ Reply to This | # ]
Advice to those without Xcode/Developer tools installed...
Authored by: kupietz on Sep 29, '06 03:57:52PM

Install them or STOP NOW.

Do not do this and then waste your afternoon troubleshooting why the LWP install didn't work. You will not get LWP installed, no matter what. You need PERL header files that only get installed if you install the 1.5GB Developer Tools package. There is another hint somewhere with just the headers as a standalone download, but they didn't work for me. I just spent hours finding this out. Thought I'd save you the time.

[ Reply to This | # ]