How UNIX is OS X?

Discussion in 'macOS' started by Caze, Jun 10, 2013.

  1. Caze macrumors newbie

    Jun 10, 2013
    I always hear people say it's POSIX compliant, and that they took a lot from FreeBSD and NeXTSTEP. But in reality, how unix like is OSX?

    If I opened up a terminal, entered sudo bash, (I already read that OSX doesn't come with a root user by default) and entered the command "chmod -R a+rwx /", would it actually do it what it would do on a real UNIX like OS? Would a bash script containing nothing but basic *NIX utils work as I would expect it to on OSX?

    If anyone here has a lot of experience with Linux or other UNIX like operating systems, how similar would you say OSX is?
  2. leman macrumors G3

    Oct 14, 2008
    OS X is basically FreeBSD ;) It is a 'real Unix', not a Unix-like OS. And actually, much of the current FreeBSD code draws from Apple codebase. Anyway, the kernel and the Unix base system of OS X is open source, you can look it all up. Also, you have all the man pages.
  3. Bear macrumors G3

    Jul 23, 2002
    Sol III - Terra
    Yes that chmod would do what you expected. And the basic Unix utils will work as you expected baring the differences between different Unix variants.

    Very similar. It is Unix.
  4. meme1255 macrumors 6502a

    Jul 15, 2012
    Czech Republic
    OS X is (at least Snow Leopard was) certified as UNIX OS :)
  5. chown33, Jun 10, 2013
    Last edited: Jun 10, 2013

    chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset

    Linux is not fully POSIX compliant:

    Yes, there are differences in commands and command options. If you want to know whether a particular shell script or command works identically on OS X, you have to specify the command, and then check which version of the command is present on a given version of OS X.

    The OS X commands are mostly available as source under the Darwin OS project:
  6. benwiggy macrumors 68020

    Jun 15, 2012
    As stated, OS X is "Certified Unix™".

    OS X does have a root user, but it is disabled from being logged into for security purposes. You can use root-level behaviours by using sudo.

    Yes, the command you give works as on other Unixes.
  7. Dalton63841 macrumors 65816


    Nov 27, 2010
    Well that's just not accurate. Go to /System/Library/CoreServices and launch Directory Utility. Click on Search Policy, and click the lock in the bottom left corner. Enter your password, then go to Edit in the menubar. There you will see an option to Enable Root User. Select it, give it a password, and log out.

    The root user is simply disabled by default, for safety reasons. And for the record, the root user account is handy for a few niche things, but keeping it enabled is just not a good idea.
  8. LordDeath macrumors member

    Feb 28, 2013
    It depends on what you are doing.
    Most command line tools are stuck at their latest GPLv2 licensed version and Apple is against using any GPLv3 software in their operating system.
    If this causes some problems to you, you can easily switch to the newer versions with the help of package managers like MacPorts.

    In the future this could cause bigger problems (security or compatibility issues) and Apple needs to either switch every little tool to an equivalent permissive licensed alternative or they have to change their view about the GPLv3.
  9. benwiggy macrumors 68020

    Jun 15, 2012
    "GNU's Not Unix" !!!!
  10. LordDeath macrumors member

    Feb 28, 2013
    This doesn't mean that their wide distribution does not qualify it as a "quasi-standard" within the Unix world.
  11. bradl macrumors 68040


    Jun 16, 2008
    Hate to say it, but whoever wrote what you read is dead wrong:

    bradl@bellicha:~> grep root /etc/passwd
    root:*:0:0:System Administrator:/var/root:/bin/sh
    bradl@bellicha:~> uname -a
    Darwin bellicha 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

    So there definitely is a root user on a Mac. It is, however, set up more "Ubuntu Style", where there is no root password, but all root commands could be run via sudo. BTW. You could run "sudo su -", supply your password, and become the root user, with root's entire environment (including shell).

    Yes, and yes. that's what makes it completely portable from one *nix OS to another. The only thing you would have to worry about is the path to where the bash binary lives.

    20-year Linux sysadmin here. It's very similar. Like someone above said, it is more similar to {Free,Net,Open,386}BSD than anything else.


Share This Page