Bash weirdness on Mac OS X Intel boxes

Just a quickie (to prevent my blog from becoming a dinosaur and eventually fossil fuel…)

If you’re running bash on an Intel Mac you might see some interesting behavior if you inspect the shell’s variables:

[jwight@ratatosk] jwight$ set | grep TYPE
HOSTTYPE=powerpc
MACHTYPE=powerpc-apple-darwin8.0
OSTYPE=darwin8.0

PowerPC? Darwin 8.0? On my Quad G5 I get identical results. Checking the bash binary with the ‘strings’ command seems to show these values are hardcoded:

[jwight@ratatosk] jwight$ strings which bash | grep powerpc
powerpc-apple-darwin8.0
powerpc

Looks like the OS version and the processor type is hardcoded into bash.

Oh and for the record this is what ‘uname’ reports:

[jwight@ratatosk] jwight$ uname -a
Darwin ratatosk 8.6.1 Darwin Kernel Version 8.6.1: Tue Mar  7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386 i386 i386

This entry was posted in Uncategorized and tagged . Bookmark the permalink.
  • robthebrew
    On a Mac Pro:
    uname -a
    Darwin computer.local 8.9.2 Darwin Kernel Version 8.9.2: Thu Feb 22 18:08:23 PST 2007; root:xnu-792.19.2~1/RELEASE_I386 i386 i386

    machine
    i486

    set | grep TYPE
    HOSTTYPE=powerpc
    MACHTYPE=powerpc-apple-darwin8.0
    OSTYPE=darwin8.0


    So nowhere is there any mention of x86-64. that really throws a spanner in the works for porting 64b apps.
  • Leo
    I did, too.
    $uname -a
    Darwin Computer.local 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386

    $set | grep -i type
    HOSTTYPE=powerpc
    MACHTYPE=powerpc-apple-darwin8.0
    OSTYPE=darwin8.0
  • stephen bigelis
    Ha I just noticed this as well on my mac book pro.
  • chris
    Still broken as of Oct. 20th, 2006. This is a Mac Pro running 10.4.8.

    $ uname -a
    Darwin delices 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
    $ set | grep -i type
    HOSTTYPE=powerpc
    MACHTYPE=powerpc-apple-darwin8.0
    OSTYPE=darwin8.0

    I'm more annoyed by the i386 kernel, personally.
  • derek
    Just noticed that myself. Very bizarre on Apple's part. Hopefully they'll fix that one of these days.
blog comments powered by Disqus