Contribute
Register

[GUIDE] Permanently disable MacOS from re-opening Apps on restart/boot

jaymonkey

Moderator
Joined
Aug 27, 2011
Messages
4,075
Motherboard
GB Z490 Vision D
CPU
i9-10850K OC @ 5.2 GHz
Graphics
RX6800-XT+UHD630
Mac
  1. MacBook Air
  2. MacBook Pro
  3. Mac Pro
Mobile Phone
  1. iOS
Background

Despite MacOS presenting a dialogue box that gives you the option to reopen (or not) apps on a restart or shutdown, in my experience I've found that most times MacOS seem to ignore whatever option you select and just goes ahead and reopens the previous open apps regardless .... even if I uncheck the reopen option.

Screenshot 2020-04-20 at 16.50.36.png


All my hacks appear to suffer from this problem and it can become very annoying if you had a lot of apps open when you shut the computer down and you have to wait for MacOS to load them all again next time you boot up, and then close them all ...

After some digging I found that MacOS stores the current session info in the following file :-

Code:
/Users/USERNAME/Library/Preferences/ByHost/com.apple.loginwindow.*.plist


Where 'USENAME' is your User ID and '*' is a UUID type alpha-hexadecimal string.

This file is actively managed by MacOS while your logged on and stores info on what Apps are currently open, window size and position. By disabling system access to this file we can permanently stop MacOS from re-opening Apps from the last session.

Method
  1. Open Terminal
  2. First we need to flag the file as owned by root (otherwise MacOS will replace it) with the following command :-
  3. Code:
    sudo chown root ~/Library/Preferences/ByHost/com.apple.loginwindow.*
  4. Next we need to remove all permissions (so that it can not be read or written to) with the following command :-
  5. Code:
    sudo chmod 000 ~/Library/Preferences/ByHost/com.apple.loginwindow.*
And thats it ..... from now on MacOS will never re-open any Apps on boot-up or restart regardless of what you selected in the reboot/shutdown dialogue box. It will also stop MacOS from re-opening Apps after a system crash.

If you need to re-enable the feature you can simply delete the existing file with the following terminal command :-

Code:
sudo rm -f ~/Library/Preferences/ByHost/com.apple.loginwindow.*


MacOS will then automatically re-create the file with the correct permissions and the feature will be re-enabled.

Cheers
Jay
 
Last edited:
Thanks Jay. My dell Hack suffered from this. funny. you posted on my B-day. I'm wondering if its something in the config file doing this. but this is the only thing that worked
 
Background

Despite MacOS presenting a dialogue box that gives you the option to reopen (or not) apps on a restart or shutdown, in my experience I've found that most times MacOS seem to ignore whatever option you select and just goes ahead and reopens the previous open apps regardless .... even if I uncheck the reopen option.

View attachment 463767

All my hacks appear to suffer from this problem and it can become very annoying if you had a lot of apps open when you shut the computer down and you have to wait for MacOS to load them all again next time you boot up, and then close them all ...

After some digging I found that MacOS stores the current session info in the following file :-

Code:
/Users/USERNAME/Library/Preferences/ByHost/com.apple.loginwindow.*.plist


Where 'USENAME' is your User ID and '*' is a UUID type alpha-hexadecimal string.

This file is actively managed by MacOS while your logged on and stores info on what Apps are currently open, window size and position. By disabling system access to this file we can permanently stop MacOS from re-opening Apps from the last session.

Method
  1. Open Terminal
  2. First we need to flag the file as owned by root (otherwise MacOS will replace it) with the following command :-
  3. Code:
    sudo chown root ~/Library/Preferences/ByHost/com.apple.loginwindow*
  4. Next we need to remove all permissions (so that it can not be read or written to) with the following command :-
  5. Code:
    sudo chmod 000 ~/Library/Preferences/ByHost/com.apple.loginwindow*
And thats it ..... from now on MacOS will never re-open any Apps on boot-up or restart regardless of what you selected in the reboot/shutdown dialogue box. It will also stop MacOS from re-opening Apps after a system crash.

If you need to re-enable the feature you can simply delete the existing file with the following terminal command :-

Code:
sudo rm -f ~/Library/Preferences/ByHost/com.apple.loginwindow*


MacOS will then automatically re-create the file with the correct permissions and the feature will be re-enabled.

Cheers
Jay
If only you knew how thankful I am!
I suffered for around a year of every time booting my laptop to the safe mode first and then rebooting normally...
I almost lost the hope to fix this "super smart" apple behavior.
Thank you!
 
I have a question that's a bit different: anyone know of a way to prevent a specific app from re-launching this way? Or even just delaying that app when relaunching?

I have a problem that if my mac reboots with music open (power outage or the occasional crash), the drive with the music folder seems to be mounted after the music app launches, which causes music to 'forgets' the music folder on an external drive and sets it to default folder on the system disk. Which is annoying as hell.

I'm sure there are other ways to deal with this but I'd *really* like to do it by preventing music from relaunching, because I actually don't use music all that much.
 
Back
Top