Print the Darwin OS Kernel version / release / machine name.
Syntax uname [-amnpsrv] Options -a Behave as though all of the options -mnrsv were specified. -m Print the machine hardware name. -n Print the nodename (the nodename may be a name that the system is known by to a communications network). -o This is a synonym for the -s option, for compatibility with other systems. -p Print the generic processor type. -r Write the current release level of the operating system to standard output. -s Print the Operating System name. This is the default if no other options are specified. -r Print the Operating System release. -v Print the Operating System version.
If the -a flag is specified, or multiple flags are specified, all output is written on a single line, separated by spaces.
The -m, -n, -r, -s, and -v variables additionally have long aliases that have historically been honored on MacOS, “UNAME_MACHINE”, “UNAME_NODENAME”, “UNAME_RELEASE”, “UNAME_SYSNAME”, and “UNAME_VERSION” respectively. These names have a higher priority than their shorter counterparts described in the previous paragraph.
The version data includes either i386, X86_64 or ARM64 indicating a 32 or 64 bit kernel.
In pre-Mountain Lion versions: during system boot you can hold down '6' and '4' to load the 64 bit kernel or hold down '3' and '2' to use the 32 bit kernel. Your machine will default into the kernel that is best supported.
The uname utility exits 0 on success, and >0 if an error occurs.
Print the machine hardware name:
$ uname -m
i386
Print the OS version:
$ uname -v
Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103
Check if we are running macOS:
if [ "$(uname -s)" == "Darwin" ]; then echo "Running MacOS" else echo "Running another OS" fi
Check if we are running a 64 bit kernel:
OS=$(uname -m) case $OS in (amd64|x86_64) bits=64 ;; (i386|i586|i686) bits=32 ;; (*) bits=unknown ;; esac echo "You have a ${bits}-bit machine."
“I have discovered the art of deceiving diplomats. I tell them the truth and they never believe me” ~ Camillo Di Cavour
Local man page: uname - Command line help page on your local machine.
hostname - Print or set system name.
serverinfo - Server information.