What is loginwindow on a Mac?
loginwindow is the macOS process that runs your login session. It starts when you sign in and stays until you log out. If you end it, you are logged out at once, and every app you had open is closed, along with any unsaved work in them. So you should not end it. If what you want is to log out, there is a safer way.
You will see loginwindow in any list of processes, often with a name that looks like an app you can close. It is not one, and it is worth knowing what it is before you click.
What loginwindow does
When you sign in, macOS starts a session for your user account. loginwindow is the process that runs it. Foreman describes it as “Login session”: “Runs your login session. Ending it logs you out.”
Your session is everything you have open as the current user: your desktop, the Dock, Finder, your apps and their windows. loginwindow holds that session together. It is not the parent of your apps in the technical sense (launchd starts those), but the session lasts only as long as loginwindow does. It is also involved in the moments around it, such as asking apps to quit when you log out or shut down, and bringing your apps back after you sign in again if you have asked macOS to reopen windows.
It does not use much processor time. It sits waiting, and you should see it near zero all day.
What happens if you end it
Ending loginwindow ends your session. The effect is the same as logging out, except that it is abrupt. Apps do not get the chance to ask whether you want to save. You can lose unsaved changes in documents, drafts, and anything else open. When the Mac returns to the login screen, you sign in again and start fresh.
That is why Foreman warns you first. It never offers to end kernel_task or launchd, and for something like WindowServer or loginwindow it explains what will happen before it does anything: you are logged out. If the warning is not what you wanted, cancel.
Note that loginwindow runs under your own account, not root, so macOS does not ask for an administrator password to end it. The warning is the only thing between you and a logout, so read it before you confirm.
Why people end up looking at it
Usually it is one of three situations.
- The Mac is acting strangely, and a list of processes shows loginwindow. It is there because it is always there. It is not the cause of the problem.
- Someone has read advice that says to end it to fix a frozen screen. That does work in the sense of forcing a logout, but there are gentler options to try first. What to do when your whole Mac freezes lists them in order.
- Curiosity. It appears with a name that looks like it could be a window, and people wonder whether it is something left open.
How to log out properly
If you want to log out, use the Apple menu, then Log Out. The keyboard shortcut is Shift-Command-Q (⇧⌘Q), and macOS asks you to confirm. This gives each app the chance to save and quit in the normal way. Apps that have unsaved work will ask you what to do.
If one app refuses to quit and holds up the logout, you can force quit just that app, from the Force Quit window (Option-Command-Escape), and then carry on. How to force quit an app on a Mac: every way that works goes through your options. That is nearly always better than ending the whole session.
When a frozen screen makes you think of ending it
If the Mac has frozen entirely, loginwindow is not the right target. If you can still move the pointer and open the Force Quit window, handle the one app that is stuck. If the screen is unresponsive and nothing works, a forced restart is the last resort, and it has the same cost as ending the session: unsaved work is lost.
If only one app is hung, how to restart a frozen app on a Mac without logging out is the answer. It keeps your session, and everything else, exactly as it is.
Terminal
In Terminal you can find it without touching it. pgrep -x loginwindow prints its process ID (one per signed-in user), and ps -p <that number> shows the line for it. These only read. Using kill on it would log you out, so there is no good reason to try. If you are curious about killing processes from Terminal in general, how to kill a process from Terminal on a Mac, and when not to covers the commands and the cases to avoid.
Seeing it in Foreman
In Foreman, loginwindow appears as “Login session” on the Processes page, with the real name in grey. That plain name tells you at a glance that it is your session, not an app. Select it and use End Task, and Foreman stops to explain that you will be logged out before it does anything. Efficiency Mode is not available for it, even though it runs under your account, because Foreman treats it as a core part of macOS.
Foreman is $12 once, free for 24 hours, and works on up to 3 Macs.
The short version
loginwindow is your login session. Leave it running. To leave the session, choose Log Out from the Apple menu, so your apps can save first. Ending loginwindow logs you out at once and closes everything, and that is why Foreman warns you before it does it.