Automatic Way to Tell if a FreeBSD system is 64 or 32-bit?

Martin McCormick martin at dc.cis.okstate.edu
Wed Mar 17 16:36:26 UTC 2010


Chris Rees writes:
 sysctl hw.machine_arch

It and uname -m work beautifully. Thanks to all.

	One thing I discovered while trying this command out on
various systems is that if the system was originally built using
i386 code, it reports as i386 even though there is a 64-bit
platform struggling to get out.

	In my script, this is not a problem because the mfsboot
CDROM for 32-bit boxes chokes on a 64-bit platform and will not
boot. When on a 64-bit system, it boots like gang busters and
since it installs its own OS, there is no question at all.

	Thank you all.

Martin McCormick


More information about the freebsd-questions mailing list