7

I came across an article explaining how to load your desktop before you login.

  • Does anyone know if this works in Lion?
  • Is there any reason I should avoid attempting it?

Load your desktop before login

  1. Go to System Preferences → Users&Groups → Login Options to enable automatic login.
  2. Then, copy and paste the following code into TextEdit.app:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>AbandonProcessGroup</key>
        <true/>
        <key>Label</key>
        <string>com.luomat.loginhook</string>
        <key>ProgramArguments</key>
        <array>
                <string>/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession</string>
                <string>-suspend</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

3. Go to Format → Make Plain Text and save the file as

    com.luomat.loginhook-2.plist

and put it in

    ~/Library/LaunchAgents
  1. After rebooting your computer, you'll notice the login screen shows up, but when you log in, your desktop and all your startup apps will be loaded and ready to go.
1
  • 2
    What this is doing is the equivalent of choosing "Login Window..." from the fast user switching menu as soon as you log in. I'd test it out by creating a test user and doing it there. Mar 12, 2012 at 14:21

2 Answers 2

2

As @eyemyth said above, the script above is the equivalent of choosing "Login Window..." from menu bar when you have user switching enabled.

The only security 'issue' I can see with doing this is that momentarily your desktop will be shown until the computer calls the script - depending on how many scripts you have or how busy your login is that may not be instantly.

Also, someone (correct me if I'm wrong) could boot into single user mode, delete the plist file and then reboot - though this is an extreme.

2
  • 2
    If somebody has physical access to your Mac and can boot into single user mode, there's not much they can't do. You can set up an admin account and gain root access within a few minutes if you know what you're doing. Mar 12, 2012 at 23:51
  • @eyemyth It goes without saying: physical security is just as important as virtual security
    – OrangeBox
    Mar 13, 2012 at 0:03
0

I tried implementing this in OSX mavericks. While it "mostly" worked, it created some issues over time. Sometimes I would have to login 2 or 3 times to get back to the desktop. I found another article that presents a perhaps cleaner method that uses the same idea (via AppleScript). Basically, I created an App, that does the "suspend" via a compiled AppleScript. I then merely added the compiled App to the end of login items (Users and Groups under System Preferences). This alternate method worked like a charm.

--LoginWindow
--This Script shows the Login Window without Logging you out.
--Nice to lock your Mac without having to close the lid.
do shell script ¬
    "/System/Library/CoreServices/Menu\\ Extras/" & ¬
    "User.menu/Contents/Resources/CGSession -suspend"

https://github.com/frostrubin/Mac-OS-X-MiniApps/blob/master/LoginWindow.applescript

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .