Boot to Command Line

Posted:
in macOS edited January 2014
How do you boot into OS X straight into the the command line? Like how a normal unix machine whould, asking for username and password, etc. Is this possiable? I know how to boot into single user mode, but thats not exactly what i want.



Just wondering?

Comments

  • Reply 1 of 17
    [quote]Originally posted by Spiffster:

    <strong>How do you boot into OS X straight into the the command line? Like how a normal unix machine whould, asking for username and password, etc. Is this possiable? I know how to boot into single user mode, but thats not exactly what i want.



    Just wondering?</strong><hr></blockquote>



    Um, if you really just want a command line and nothing else, you could install Linux/BSD... but I know that probably isn't what you want...
  • Reply 2 of 17
    jahyjahy Posts: 54member
    I don't know how to boot directly into the command line, but you can login as &gt;console at the login screen. From there you can login in as whatever user you want (in the command line).



    I wonder if you could trick OS X to automatically boot into &gt;console like how it can automatically log in a user.
  • Reply 3 of 17
    defiantdefiant Posts: 4,876member
    It's a MACINTOSH !!! goddamit ! GUI !! no &gt;console ... <img src="graemlins/oyvey.gif" border="0" alt="[No]" />
  • Reply 4 of 17
    [quote]Originally posted by Defiant:

    <strong>It's a MACINTOSH !!! goddamit ! GUI !! no &gt;console ... <img src="graemlins/oyvey.gif" border="0" alt="[No]" /> </strong><hr></blockquote>



    No Sh*t its mac. I've used em way before OS X. I was just wondering if it was possible. Something wrong with asking questions?
  • Reply 5 of 17
    not sure about osx or bsd, but linux use the directory /etc/rc.d/ and the subdirectories in it. Normally these are numbered rc0, rc1 ... rc6 corresponding to the runlevel the operating system is loading.



    In each of these directories is a symbolic link to a program file. eg k30apache, k12named, s10mysql, s14apache.



    The "S" links start programs when that run level is used, and the "k" links kill them off when that runlevel is shutdown. Also the programs are loaded in the order of the numbers.



    IF OSX (i am still saving for my new mac) uses this kind of method, you might be able to change the symolic links.



    WARNING!!!!

    If this is the case and you remove the wrong ones, you may find it very hard to boot into osx properly!
  • Reply 6 of 17
    [quote]Originally posted by Jahy:

    <strong>I don't know how to boot directly into the command line, but you can login as &gt;console at the login screen. From there you can login in as whatever user you want (in the command line).</strong><hr></blockquote>



    And how whould you go about this?
  • Reply 7 of 17
    I tried making a new user in my User prefs but the &gt; char is forbidden in the short name feild. So there would have to be a hack of some kind I would think.



    Mac Guru
  • Reply 8 of 17
    I guess ill answer my own question. <img src="graemlins/lol.gif" border="0" alt="[Laughing]" />



    On the login window, hit the down arrow (or similar key), to highlight, but not select the user. Then hold option and hit enter. Then when it prompts you for a user name, type &gt;console. Now your in, just as i wanted.



    Damn i feel nerdy tonight.
  • Reply 9 of 17
    keshkesh Posts: 621member
    If you want to boot straight into the command line, hold Cmd-Shift-S as the Mac starts. That puts you in 'single user mode' and you get to watch all the pretty text fly up your screen as everything loads.
  • Reply 10 of 17
    Kesh: He already said that he knows about single-user mode and that that is not what he wants. The biggest problem with SU-mode is that the user has FULL access to EVERYTHING. A standard login prompt would be much better.



    Anyhow, yes, the option-enter after selecting a name is exactly the procedure for getting the login/pass text fields (sorry I didn't see this thread sooner). In 10.1 you could easily enable the button for that in the System Prefs, but in 10.2 you have to resort to this trickery.



    I'm curious, though. Why do you want it to boot up to a command line? Just for kicks? As I recall, it's rather difficult to start up the Aqua GUI yourself. An X11 environment is far easier. If you are doing this for the latter, you'd really probably be better off with Linux or some other BSD distro.



    [ 12-18-2002: Message edited by: Brad ]</p>
  • Reply 11 of 17
    jahyjahy Posts: 54member
    The thing about linux is that it is weird and scary :-)



    I've booted into the command line before and started x-windows (I was using gnome) just to see what it was like. I think it is neat because it helps me get an idea of what linux is like, while not dealing with anything but OS X (and aqua is always nearby).



    Thanks for telling about the option enter thing, that will be very useful!
  • Reply 12 of 17
    I was just wondering, after I boot into single user mode, how do I exit and reboot normally?
  • Reply 13 of 17
    paulpaul Posts: 5,278member
    hehe

    [code] reboot

    </pre><hr></blockquote>

    no joke

    heh
  • Reply 14 of 17
    bartobarto Posts: 2,246member
    Single User Mode doesn't need a log-in, but I'm not sure if you are aware of the complete way to boot it.



    When the computer starts up, hold down "command-s".



    When it asks you to type "fsck -y", do it. This is to fix up any errors in your hard disk. If errors were fixed, run it again (fsck only fixes one error at a time).



    After that, type "mount -uw /" to gain access to the boot drive.



    Now type "SystemStarter", and that is basically the "Welcome to Macintosh" screen, only in console rather than graphics.



    Now type the name of your favourite shell for navigating (the Mac OS X default is "tcsh").



    That's it. A way to gain full access to ANY Mac OS X system in the world (as long as it doesn't have an OpenFirmware password set - those are evil, never set them by the way).



    "su -u &lt;user&gt;" to Switch Users.



    -------------



    Turn automatic log-in on, and set the user to &gt;console. Now hold down "command-v" at startup to not load the GUI. Simple, except for the fact that it's not automatic.



    Barto



    [ 12-19-2002: Message edited by: Barto ]</p>
  • Reply 15 of 17
    paulpaul Posts: 5,278member
    isn't it

    [code] /sbin/fsck -y </pre><hr></blockquote>

    ?? <img src="confused.gif" border="0">
  • Reply 16 of 17
    bartobarto Posts: 2,246member
    You can type the full path if you really want to, but Unix will run any binary with just the filename if the binary is located in a Unix binary folder. For example:



    /sbin/

    /sw/sbin/

    /usr/sbin/



    /bin/

    /sw/bin/

    /usr/bin/

    /usr/x11r6/bin/



    Barto



    [ 12-19-2002: Message edited by: Barto ]



    [ 12-19-2002: Message edited by: Barto ]</p>
  • Reply 17 of 17
    Actually, it finds those "binary folders" by checking a PATH variable for each user. That is why it is important to enter the full path of the binary; if you change your PATH variable, it could point to a different binary altogether.



    My current user's PATH variable, for example, contains:



    /Users/bwsmith/bin/powerpc-apple-darwin

    /Users/bwsmith/bin

    /usr/local/bin

    /usr/bin

    /bin

    /usr/local/sbin

    /usr/sbin

    /sbin



    If you install fink and xfree86, it should add the /sw/sbin/, /sw/bin/, and /usr/x11r6/bin/ that Barto listed.



    Also, rather than using "reboot" after being in single-user mode, you could enter "exit" to continue booting up.



    [ 12-19-2002: Message edited by: Brad ]</p>
Sign In or Register to comment.