How to boot MacOS X, Linux , without GUI ?

tcma13
4 min readDec 9, 2019

If u are interested in operating systems , u might know that Unix and Windows differ due to various reasons and one of them is the GUI approach.

Windows has a built-in GUI into kernel which cannot be manipulated while Unix has an out-of-the-kernel GUI, hence one can switch on and switch off.

Built-in-kernel is very disadvantageous, but that’s what we have

I mean, when we use an operating system on a server, where all your actions are using a terminal.

The GUI is not mandatory but the existing technique of windows puts extra load on the CPU and the RAM.
While the UNIX and other similar systems provide us with the option of switching on and off, thereby reducing the overall loads on system architecture.

Programs like run-levels make the above much more efficient, for more details you can read here

If we talk about MacOS X, u can`t switch yourself before u boot -

OS X does not have runlevels. It natively boots into the GUI.

Remember, not all versions of Mac OS support this feature.

If you want to boot in single-user-mode:

  1. Boot MacOS X as usual.
  2. At the login screen, choose “Other”.
  3. For username, type the following and then hit return — no password is necessary yet.
  4. >console.

5.Hit the Return key.

Again:

1. First you have the login window set to show “Name and Password”:

2.Then you can login as “>console” as the username (no password) and get a terminal prompt.

This will exit the GUI and drop you into a shell.

If successful, you will see a login prompt at the command line, as if you just booted up a unix environment without a windowing environment, now enter a user name and password to login directly to the command line as that user

http://osxdaily.com/2018/09/02/access-login-console-terminal-mac/

But if you found that it doesn`t work (may be newer versions) , hence developers switched it off , but u can still try to enable it via console:

sudo defaults write /Library/Preference/com.apple.loginwindow.plist "DisableConsoleAccess" NO

It usually works till 10.13.2 version.

Also u can try to read docs on apple support official page , prolly they will add some useful information for this method ( may be not )

When u enter your terminal ,u should know some commands , so i`d recommended to learn it before u go.

And now let`s talk about Linux`s turning off GUI and working without it

As mentioned above , Linux unlike MacOS ( and ofc Windows ) has runlevels.

Remember, not all versions of Linux support this feature.

Talking more concrete there is 7 levels (0–6) to start your work , so:

  • 0 — Halt.
  • 1 — Single-user text mode.
  • 2 — Not used (user-definable).
  • 3 — Full multi-user text mode.(3 means non-GUI mode).
  • 4 — Not used (user-definable).
  • 5 — Full multi-user graphical mode ( 5 means GUI ).
  • 6 — Reboot.

If you want to turn off your GUI u have 2 ways to accomplish this:

You can:

  1. Edit your config file (e.g /etc/inittab)

vim /etc/inittab

Then u will see the table like u seen above with only extra string like :

id: any_number_that_defines_your_current_mode : initdefault

So you need to change your any_number_that_defines_your_current_mode to number_ you_are_currently_needed ( in our case it`s number 3 )

Then we reboot our system and after that we will enter in the text mode , as we were wished that before.

This method u can meet when u work with RedHat Linux, also RedHat is a great example of server linux-based decision that no needs GUI mostly.

Also here you can see how other people did this:

https://www.youtube.com/watch?v=npbCnVHk8nY

But method of using runlevels might be deprecated in some linux`s distros

So now it`s being promoting to use systemd . More detailed here and here .

So the second approach is using systemctl — utility of systemd

If u are interested in systemd , so feel free to follow the links below:

https://www.youtube.com/watch?v=KftuGM_ylKg&t=4s

https://www.tecmint.com/systemd-replaces-init-in-linux/

http://0pointer.de/blog/projects/why.html

There are two commands you may be needed for manipulating with GUI:

systemctl isolate mutli-user.target — it will push you to runlevel “3” where you have no GUI at all

systemctl isolate graphical.target — it will push you to runlevel “5” where you exactly have GUI

Also here u can see how other people did this:

https://www.youtube.com/watch?v=jbYucYX1WwM

Let`s notice that this method works not only in redhat but also is all .deb .rpm distros so feel free to use it if / when you are needed.

Good Luck!

P.S

More about me :

https://github.com/ulmee

https://habr.com/en/users/0xul/

--

--