Skip to content

The Eclectic Light Company

Macs, painting, and more
Main navigation
  • Downloads
  • M1 & M2 Macs
  • Mac Problems
  • Mac articles
  • Art
  • Macs
  • Painting
hoakley March 18, 2023 Macs, Technology

loginwindow does more than log you in

If there’s a Cinderella in macOS, it has to be loginwindow. While it has its moment of glory when it provides the one window we all have to use, to log in, it does a great deal more work behind the scenes, which passes largely unacknowledged. Browse the log for the seconds immediately after you’ve logged in and you’ll see what I mean: every other entry is from loginwindow as its sets everything up for the newly logged-in user. It’s a proper application too, found in /System/Library/CoreServices, so part of the Signed System Volume (SSV) in Big Sur and later, even though it isn’t allowed a distinctive icon. Poor Cinders!

Startup

After the kernel and launchd, loginwindow is probably the third most important process to run in macOS, although it’s not given a distinctive process ID. It’s run by launchd late during the boot process, once sufficient system services have been loaded and prepared for control to be handed over to a user.

Its most obvious task is to prepare, display, handle and destroy the user login window. This is shown following every startup (not in special modes such as Recovery), except when auto-login is configured (only permitted when FileVault isn’t enabled), and the reboot performed at the end of installing a macOS update.

Once a valid user and password have been entered, and FileVault has been unlocked together with the login keychain, loginwindow gets to work creating the user environment, loading up user processes, configuring all user settings, and loading key apps to create the GUI environment, including the Desktop, Dock and Finder. It’s also responsible for loading user Login Items.

With the bulk of its work complete, loginwindow still isn’t done, and you’ll find it as an active process in Activity Monitor, as it persists until the Mac is shut down. It’s then responsible for handling the Force Quit dialog, together with logout, restart and shut down actions.

It works closely at times with TAL, the macOS Transparent App Lifecycle, which helps it restore sessions across reboots using the many folders containing saved states in the ~/Library/Saved Application State folder. You’ll also see TAL active in the log as the subsystem com.apple.talagent.

App startup

Among everything else that’s going on when you open an app, loginwindow does its bit too. This involves creating a new active tracking timer, and checking the app in. You may also see its log entries referring to ‘snapshots’, although those are saved states of the app, not APFS snapshots. In conjunction with TAL, loginwindow keeps track of background and foreground apps, and maintains a list of apps to be relaunched in the event of a restart or shutdown. Those records are removed when the app is quit.

Shutdown

When the user chooses a command to log out, restart or shut down the Mac, that sends an AppleEvent to loginwindow, which displays the normal confirmation dialog. If the user confirms the action, loginwindow is then responsible for quitting all user processes. For apps, this in turn results in each calling their applicationShouldTerminate code, or receiving an AppleEvent to quit. They are then given 45 seconds grace to reply or quit, after which their termination sequence is stopped, leaving the user to handle that app in a Force Quit dialog if necessary.

Background processes are first sent an AppleEvent, then loginwindow sends them a SIGKILL signal to finish them off. System daemons should receive a SIGTERM signal initially, followed a few seconds later by SIGKILL. Once all processes have gone, loginwindow initiates the logout, restart or shutdown as appropriate.

Not only is loginwindow there in its full glory at the start of the user phase of startup, but it’s there until the bitter end.

Reference

Apple’s Daemons and Services Programming Guide, last revised in 2016.

Share this:

  • Twitter
  • Facebook
  • Reddit
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Related

Posted in Macs, Technology and tagged login, loginwindow, macOS, macOS 13, shutdown, TAL, Ventura. Bookmark the permalink.

9Comments

Add yours
  1. 1
    Jerry on March 18, 2023 at 12:46 pm
    Reply

    It also seems to take roughly a quarter of all computer resources at many times long after login … tried just the other day to see what made it use more energy than other energy heavy drawing software, but failed to mail it down.

    LikeLiked by 1 person

    • 2
      hoakley on March 18, 2023 at 4:26 pm
      Reply

      loginwindow shouldn’t be using significant CPU or memory more than a few seconds after login. I think maybe a trip to the log is needed to investigate?
      Howard.

      LikeLike

      • 3
        Jerry on March 18, 2023 at 4:30 pm
        Reply

        Yes, likely so. Still dread to try it though and the reason I first heard about you was because of your tools to handle the log – so should practise a bit more ..

        LikeLiked by 1 person

        • 4
          hoakley on March 18, 2023 at 4:35 pm

          I’ll see if I can write you a little tutorial next week to give you a start.
          Howard.

          LikeLike

  2. 5
    Duncan on March 18, 2023 at 3:31 pm
    Reply

    “After the kernel and launchd, loginwindow is probably the third most important process to run in macOS, although it’s not given a distinctive process ID.”

    I’m seeing a PID assigned in Activity Monitor (it’s currently 4925 for my non-admin user account). Do you mean that it’s not given a PID at its start, but assigned one later?

    LikeLiked by 1 person

    • 6
      hoakley on March 18, 2023 at 4:30 pm
      Reply

      “it’s not given a distinctive process ID”
      Every process from the kernel onwards has a process ID (PID). However, only two have *distinctive* PIDS: the kernel (0) and launchd (1). Those are useful, as you only have to see either and you know immediately which process they refer to. Sadly, loginwindow comes too late in the boot sequence to get a *distinctive* PID, as does WindowServer, another key process.
      Howard.

      LikeLike

      • 7
        Duncan on March 18, 2023 at 6:45 pm
        Reply

        Thank you for the explanation. I wasn’t aware that ‘distinctive’ PIDs stood apart.

        LikeLiked by 1 person

  3. 8
    gaelans on March 18, 2023 at 3:33 pm
    Reply

    Wait, who shows the login screen at boot when FileVault is enabled? I’d assumed it was the bootloader (because the kernel and loginwindow live on the encrypted disk), but is that not the case anymore? (Is the SSV stored unencrypted? I suppose that would make enough sense.)

    LikeLiked by 1 person

    • 9
      hoakley on March 18, 2023 at 4:34 pm
      Reply

      “who shows the login screen at boot when FileVault is enabled?” loginwindow, as I’ve explained.
      “the kernel and loginwindow live on the encrypted disk” the Data volume is encrypted, not the System volume or SSV, as explained in Apple’s Platform Security Guide. Otherwise iBoot couldn’t boot the kernel as it has to. LLB and iBoot aren’t equipped with anything like the GUI etc. that loginwindow needs, nor access to usernames and passwords.
      There’s also no need for the System volume, SSV, or Recovery volumes to be encrypted – they don’t contain any protected data.
      Howard.

      LikeLike

Leave a Reply Cancel reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. ( Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. ( Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. ( Log Out /  Change )

Cancel

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Quick Links

  • Downloads
  • Mac Troubleshooting Summary
  • M1 & M2 Macs
  • Mac problem-solving
  • Painting topics
  • Painting
  • Long Reads

Search

Monthly archives

  • March 2023 (49)
  • February 2023 (68)
  • January 2023 (74)
  • December 2022 (74)
  • November 2022 (72)
  • October 2022 (76)
  • September 2022 (72)
  • August 2022 (75)
  • July 2022 (76)
  • June 2022 (73)
  • May 2022 (76)
  • April 2022 (71)
  • March 2022 (77)
  • February 2022 (68)
  • January 2022 (77)
  • December 2021 (75)
  • November 2021 (72)
  • October 2021 (75)
  • September 2021 (76)
  • August 2021 (75)
  • July 2021 (75)
  • June 2021 (71)
  • May 2021 (80)
  • April 2021 (79)
  • March 2021 (77)
  • February 2021 (75)
  • January 2021 (75)
  • December 2020 (77)
  • November 2020 (84)
  • October 2020 (81)
  • September 2020 (79)
  • August 2020 (103)
  • July 2020 (81)
  • June 2020 (78)
  • May 2020 (78)
  • April 2020 (81)
  • March 2020 (86)
  • February 2020 (77)
  • January 2020 (86)
  • December 2019 (82)
  • November 2019 (74)
  • October 2019 (89)
  • September 2019 (80)
  • August 2019 (91)
  • July 2019 (95)
  • June 2019 (88)
  • May 2019 (91)
  • April 2019 (79)
  • March 2019 (78)
  • February 2019 (71)
  • January 2019 (69)
  • December 2018 (79)
  • November 2018 (71)
  • October 2018 (78)
  • September 2018 (76)
  • August 2018 (78)
  • July 2018 (76)
  • June 2018 (77)
  • May 2018 (71)
  • April 2018 (67)
  • March 2018 (73)
  • February 2018 (67)
  • January 2018 (83)
  • December 2017 (94)
  • November 2017 (73)
  • October 2017 (86)
  • September 2017 (92)
  • August 2017 (69)
  • July 2017 (81)
  • June 2017 (76)
  • May 2017 (90)
  • April 2017 (76)
  • March 2017 (79)
  • February 2017 (65)
  • January 2017 (76)
  • December 2016 (75)
  • November 2016 (68)
  • October 2016 (76)
  • September 2016 (78)
  • August 2016 (70)
  • July 2016 (74)
  • June 2016 (66)
  • May 2016 (71)
  • April 2016 (67)
  • March 2016 (71)
  • February 2016 (68)
  • January 2016 (90)
  • December 2015 (96)
  • November 2015 (103)
  • October 2015 (119)
  • September 2015 (115)
  • August 2015 (117)
  • July 2015 (117)
  • June 2015 (105)
  • May 2015 (111)
  • April 2015 (119)
  • March 2015 (69)
  • February 2015 (54)
  • January 2015 (39)

Tags

APFS Apple AppleScript Apple silicon backup Big Sur Blake bug Catalina Consolation Console diagnosis Disk Utility Doré El Capitan extended attributes Finder firmware Gatekeeper Gérôme HFS+ High Sierra history of painting iCloud Impressionism iOS landscape LockRattler log logs M1 Mac Mac history macOS macOS 10.12 macOS 10.13 macOS 10.14 macOS 10.15 macOS 11 macOS 12 macOS 13 malware Mojave Monet Monterey Moreau MRT myth narrative OS X Ovid painting Pissarro Poussin privacy realism Renoir riddle Rubens Sargent scripting security Sierra SilentKnight SSD Swift symbolism Time Machine Turner update upgrade Ventura xattr Xcode XProtect

Statistics

  • 14,160,141 hits
Blog at WordPress.com.
Footer navigation
  • About & Contact
  • Macs
  • Painting
  • Language
  • Tech
  • Life
  • General
  • Downloads
  • Mac problem-solving
  • Extended attributes (xattrs)
  • Painting topics
  • Hieronymus Bosch
  • English language
  • LockRattler: 10.12 Sierra
  • LockRattler: 10.13 High Sierra
  • LockRattler: 10.11 El Capitan
  • Updates: El Capitan
  • Updates: Sierra, High Sierra, Mojave, Catalina, Big Sur
  • LockRattler: 10.14 Mojave
  • SilentKnight, silnite, LockRattler, SystHist & Scrub
  • DelightEd & Podofyllin
  • xattred, Metamer, Sandstrip & xattr tools
  • 32-bitCheck & ArchiChect
  • T2M2, Ulbow, Consolation and log utilities
  • Cirrus & Bailiff
  • Taccy, Signet, Precize, Alifix, UTIutility, Sparsity, alisma
  • Revisionist & DeepTools
  • Text Utilities: Nalaprop, Dystextia and others
  • PDF
  • Keychains & Permissions
  • LockRattler: 10.15 Catalina
  • Updates
  • Spundle, Cormorant, Stibium, Dintch, Fintch and cintch
  • Long Reads
  • Mac Troubleshooting Summary
  • LockRattler: 11.0 Big Sur
  • M1 & M2 Macs
  • Mints: a multifunction utility
  • LockRattler: 12.x Monterey
  • VisualLookUpTest
  • Virtualisation on Apple silicon
  • LockRattler: 13.x Ventura
Secondary navigation
  • Search

Post navigation

Reading visual art: 44 What’s wrong in that painting? 2
Saturday Mac riddles 195

Begin typing your search above and press return to search. Press Esc to cancel.

  • Follow Following
    • The Eclectic Light Company
    • Join 3,176 other followers
    • Already have a WordPress.com account? Log in now.
    • The Eclectic Light Company
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
%d bloggers like this: