How UNIX is OS X?

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

  1. Caze macrumors newbie

    Joined:
    Jun 10, 2013
    #1
    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 604

    Joined:
    Oct 14, 2008
    #2
    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

    Joined:
    Jul 23, 2002
    Location:
    Sol III - Terra
    #3
    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 6502

    Joined:
    Jul 15, 2012
    Location:
    Czech Republic
    #4
    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

    Joined:
    Aug 9, 2009
    #5
    http://en.wikipedia.org/wiki/POSIX#Fully_POSIX-compliant

    Linux is not fully POSIX compliant:
    http://en.wikipedia.org/wiki/POSIX#Mostly_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:
    http://en.wikipedia.org/wiki/Darwin_(operating_system)
     
  6. benwiggy macrumors 68020

    Joined:
    Jun 15, 2012
    #6
    As stated, OS X is "Certified Unix™". http://www.unix.org/what_is_unix/the_brand.html

    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

    Dalton63841

    Joined:
    Nov 27, 2010
    Location:
    SEMO, USA
    #7
    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

    Joined:
    Feb 28, 2013
    #8
    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

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

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

    bradl

    Joined:
    Jun 16, 2008
    #11
    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.

    BL.
     

Share This Page