Detect BSD Libraries installed in OSX?

Alex Rice alrice at ARCplanning.com
Tue Jun 3 23:06:01 EDT 2003


On Tuesday, June 3, 2003, at 08:08  PM, RGould8 at aol.com wrote:

> Is there a way to detect if the BSD libraries have been installed on a 
> user's Mac OS X system?  From my understanding, the default OS X 
> install comes with the BSD libraries, however, if the user for some 
> reason has opted to disable them, certain unix calls I've been using 
> fail in Revolution, like the "grep" command.  I suppose I could do a 
> test to see if the grep command gives an error, but wonder if there's 
> a better way.

I haven't tested this, but guessing you could check for the existence 
of /Library/Receipts/BSD.pkg

However, it would be more robust to check for existence command before 
you use shell(). The user could have modified the contents of 
/usr/bin/. This might be especially common among users of Fink who 
install bunches of stuff into /sw/bin. Maybe they leave /usr/bin alone 
and just change their path, or maybe they delete stuff? To be really 
robust, use which to locate the command in question:

# which which
/usr/bin/which

Unix is so weird! :-)

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the use-livecode mailing list