Switching to text console Linux-style?

Discussion in 'macOS' started by Jochen K, May 12, 2017.

  1. Jochen K macrumors member

    Aug 29, 2014

    a word of caution: the following terminology may be misleading; I learned it from different sources: Linux and macOS. By "terminal" I refer to Terminal.app, by "(text mode) console" to a shell not running inside Terminal.app, but independently from the GUI (and not Console.app).

    After having had some minor exposure to Linux, I miss most on macOS (12.4) the ability to directly switch to a text mode console (that is, not inside the GUI in a terminal) to fix some errand process or to restart the GUI -- both of which is undoubtedly technically possible (remote login via ssh over wlan, e.g.). Most importantly for me it is then possible to run aria2 in a console and let bigger downloads be carried out in a safer environment than the more crash-prone gui. This is, again, obviously possible by connecting via ssh. But as soon as this connection is disrupted (by, say, a short breakdown in signal strength) I am logged out and aria2 (for example) terminates.
    I have, therefore, three questions: 1. Is it somehow possible to switch to a different console locally? Alternatively, how may I invoke a process, probably via launchd (and launchctl), into a different console than the one one finally starting the GUI? According to the corresponding man-page "launchctl reboot logout" should be integratable into a users config. (Which would mean, as far I can tell, that a frozen GUI restarts by itself, without interruption of non-gui processes; please correct me, if I am wrong here.)

    I hope anyone can help!

    Kind Regards
    Jochen Kaiserswerth
  2. Yahooligan macrumors 6502a


    Aug 7, 2011
    Install "screen" or "tmux" and run your CLI processes within one of those sessions, a GUI or Terminal.app (Terminal.app is crap, iTerm 2 is much better) crash won't kill what is running inside screen/tmux and you can easily re-attach to the session.

    I would be more concerned with your GUI and other crashing issues, that is not normal.
  3. Jochen K thread starter macrumors member

    Aug 29, 2014
    Dear Yaholigan,

    this has to be the single most useful piece of advice I ever got regarding anything computer-related! Thank you so much! — BTW, there is no problem with crashes; they rarely happen. But I do schedule really big downloads (50-150 GB, say) during my sleeping hours. And there are worse things indeed, but it is nonetheless distressing to notice in the morning that such a download has failed by a few GB because of a GUI „hiccup“.

    So, there remains this question: is it possible to restart just the GUI in case it has become completely unresponsive? I tend to disable wlan most of the time (it seems to eat away 1/5 of bandwidth compared to lan, for whatever reason), so remote login is not an option.

    But again, this advice was most welcome!

  4. chown33 Moderator

    Staff Member

    Aug 9, 2009
    Maybe run the downloader with 'nohup'. See its man page.
  5. Yahooligan macrumors 6502a


    Aug 7, 2011
    Glad I could help! My job involves lots of remote work so keeping certain tasks running after I disconnect and being able to easily reconnect is rather important. :)

    I'm not aware of any way to restart the entire GUI, no. It's not like you could just kill the X11 server or window manager like on Linux (It's been a while, ctrl-alt-bksp used to kill X11) and have it respawn. I can't say I've ever had the whole GUI hang before, I have had it crash and restart on its own when I had a failing GPU though.

    Good luck!
  6. foxlet macrumors 6502


    Aug 5, 2016
    The only way to enter text mode while in userland for OS X is to enter from LoginWindow (using the >console user). Otherwise you can run detach terminal sessions using tools like screen.

Share This Page

5 May 12, 2017