So I've been getting more and more into my UNIX system, a mac, and I wanted to know where it goes to execute a log-in. I know where it keeps the passwords and such, but I would like to see the script it runs at log-in. I did find /usr/bin/login but neither vim nor nano will show anything that looks like code(eg. it's 90% @ symbols). So if that is the file how can I read it?

  • Is this what you're looking for: stackoverflow.com/a/97164/490315 ?
    – whirlwin
    Commented Mar 21, 2013 at 23:12
  • The "@symbols" you saw mean that /usr/bin/login is actually a binary file. You should try looking for its source code in your repos.
    – Joseph R.
    Commented Mar 21, 2013 at 23:14
  • @whirlwin Not exactly, I'm trying to see what Unix does to start up, so then I can get greater knowledge about Unix
    – Hovestar
    Commented Mar 21, 2013 at 23:18
  • 4
    Despite the fact that OSX is POSIX-compliant and SUS certified, I personally would look in other places for things to learn. For example Linux, BSD or (Open)Solaris. All very easy to install via VM. Just my 2 cents.
    – schaiba
    Commented Mar 21, 2013 at 23:40
  • 2
    The graphical login components of OSX aren't open source, so it's unlikely you'll be able to see the source of it (and do you know Objective C? Because that's likely what its written in). OSX isn't a great place to start learning about the internals of the OS due to its closed source, try Linux or one of the BSDs.
    – jsbillings
    Commented Mar 22, 2013 at 12:36

2 Answers 2


It depends... if you start a console login, a program usually called getty (in Fedora Linux, agetty(8)) shows the login: prompt, asks for the username and passes that to login(1), which gets the user's information, asks for the password and (if successful) sets up the environment and starts a shell for the user. The login program is quite standard, the Linux one is part of the util-linux package. The FreeBSD version is here (that is probably nearer the MacOS one than the Linux version).

For a graphical login, there is a greeter program like xdm(1) or something more elaborate like gdm, which does most of the above, but starts an X session with predefined programs running.


As you are running Mac OSX, you can use dtrace execsnoop in a terminal to see all commands executed:

nohup sudo execsnoop -v > /var/tmp/execsnoop.log &

Then logout and login and you'll see what your OS is running.

You might modify this dtrace script for it to use anonymous tracing and then see all programs executed while your OS is booting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .