Check for BSD Subsytem

Is there any enviornment variable or something else I can use to check to see that the BSD subsystem is installed on a Mac OS X Machine? Preferably something that’s like sw_vers that will work across versions.

I can check for pieces or the receipt, but I’d rather just get a thumbs up or down.

There’s no environment variable or system property that I know of… but I don’t know a lot of things. :cool:

Doesn’t sound like much sense to use the existence of an installer to check for the existence of the files found in the installer. That’s a conflict waiting to happen. :o

From what “people” on the interweb are saying, it sounds like searching for the unix file /usr/bin/apropos is a good indicator of whether it’s installed or not. Don’t have a machine without bsd installed, so I can’t verify that this is true… but I saw this advice in multiple places, so it’s at least a start. This works for me…

tell application "Finder"
	exists ("/usr/bin/apropos" as POSIX file)
end tell

j

great suggestion, this is just what I was hoping to find out. I checked the BOM for the BSD.pkg and it seems that apropos is indeed included. Now I’ll just have to make sure it’s part of Panther and Jaguar as well.

Thanks too for the code to test for apropos. Unfortunately, I can’t use it because I just went though the process of eliminating all references to the Finder in my app - I’ll have to find another way, though that might be hard if I can’t use the shell :slight_smile:

What about this?

try
	do shell script "/usr/bin/apropos apropos"
	set BSD to true
on error errMsg number errNum
	if errNum is 127 then set BSD to false -- No such file or directory
end try