virtualp

macrumors newbie
Original poster
Sep 3, 2020
5
0
Hello,
I am currently running a bootable SSD (NVMe 1.3 / PCIe 3.0) over Thunderbolt 3 (on my iMac 2017). I want this not just for the performance and storage space boost, but mainly for moving between home/travel (MBP with TB3) and office (iMac), without having to remote-in etc.

Now, I really don't want to shutdown and boot up the OS, every time I leave/start home/office. I know I can choose the option to reopen apps before shutdown - but it's still not the same, as I have several tabs opened on Chrome and many windows of Visual Studio Code running.

Ideally if there is a way (or a software) to save the "state" to the disk/ssd that can used to reload after boot, that should do the job.

Thanks,
Pradeep
 

Fishrrman

macrumors Core
Feb 20, 2009
22,222
8,270
If you remove the drive from one Mac and connect it to another, you're going to have to reboot (if you want to boot from the removable drive).

There is no way around this reality.
 
  • Like
Reactions: virtualp

joevt

macrumors 68040
Jun 21, 2012
3,352
1,536
Chrome is usually pretty good at reopening windows and tabs (like Safari) after a reboot. There might be a setting to change for that to happen.

The only sure way to do this is make a macOS virtual machine using something like Parallels. Parallels can suspend and resume the VM. The VM will have slightly less performance than normal.
 
  • Like
Reactions: virtualp

virtualp

macrumors newbie
Original poster
Sep 3, 2020
5
0
Chrome is usually pretty good at reopening windows and tabs (like Safari) after a reboot. There might be a setting to change for that to happen.

The only sure way to do this is make a macOS virtual machine using something like Parallels. Parallels can suspend and resume the VM. The VM will have slightly less performance than normal.
I use various other applications and not all are able to do that. Virtual machine is definitely an option, but yes it's not like-to-like - and it doesn't work for me in the long run.
 

LuisN

macrumors 6502a
Mar 30, 2013
618
530
Torres Vedras, Portugal
I use various other applications and not all are able to do that. Virtual machine is definitely an option, but yes it's not like-to-like - and it doesn't work for me in the long run.
Try this:
Unselect the option "Close windows when quitting an app" like bellow
Captura de ecrã 2020-09-11, às 18.50.54.png
 

joevt

macrumors 68040
Jun 21, 2012
3,352
1,536
When you go to shutdown, there is an option to "Reopen windows when logging back in".

I don't have this selected because I can manually launch each app very easily and this way I can choose to not launch apps in case I want to restart again quickly. The apps will remember their windows whether they are are launched automatically or not.
Shutdown.png

The Chrome setting looks like this:

Chrome.png



But yeah, I believe you that some apps don't have the same behaviour.
 

virtualp

macrumors newbie
Original poster
Sep 3, 2020
5
0
Actually I found out that the "Reopen windows when logging back in" works only when I reboot it on the same Mac machine.

Now even though am prepared to use this feature by shutting down / booting (boot time or inconvenience of losing some applications was not my main issue), but when I shutdown my iMac and go home to boot it on my MBP, then it doesn't work. It actually tries to re-open windows from my last MBP session.
It makes me wonder how we can intercept this "file" that stores all the info, including an association to the machine.
 

Head_Unit

macrumors newbie
May 12, 2020
16
3
It seems what you want is a "hibernate" feature, which I dearly wish Macs had. However, would that work from a cold boot on a different machine anyway? Good question-any Windoze users know? (I use it a fair bit, but never tried that particular trick)
 

theSeb

macrumors 604
Aug 10, 2010
7,465
1,874
Now-here
It depends on the hardware differences between the two machines, but you'll probably be able to boot into safe mode. Previous versions of Windows would probably not even boot and require a reinstall, but this has gotten better over the years.

Also depending on the Windows license you are using it may not allow you to boot at all, or allow you to switch a few times before locking your license. You can phone MS and ask them to unlock it. They are pretty good about it, as long as you promise you won't be using the previous machine from now on and you are not phoning them to unlock on a regular basis. This of course assumes normal consumer and OEM licenses of Windows. They are only licensed for one computer. OEM is licensed to specifically just that computer, but if you phone them and are not shouting and have a good explanation, then they will allow you to move forward a few times (let's say you swapped the motherboard for example) . A retail version of Windows is not locked to one computer, but you are only allowed to use it on one computer. It will allow you to switch a few times before it locks automatically. Explaining that you are trying to use two machines at the same time will not go down well with support.

So, in a nutshell, no, this does not work very well in Windows.

As for the OP, I don't understand why you are trying to complicate your life. Visual Studio Code keeps all of its open windows etc in a file. So either use an online source code repository and don't ignore the VSC solution files, or use a cloud file storage and keep your project there. That way it can be synced between all of your computers. I think using the same drive on multiple macs is just a bad idea.
 

virtualp

macrumors newbie
Original poster
Sep 3, 2020
5
0
I think using the same drive on multiple macs is just a bad idea.
Technically speaking, NVMe SSDs and TB3 make this a possibility and MacOS has been playing well except that last missing link that would otherwise make it pretty seamless.

Personally, it will make my life easier - so why not. I get all the power of a given hardware depending upon which Mac setup I'm on. For ex. iMac at my office offers big screen, graphics and convenience along with the fact that I'm trying to keep work at office primarily. Some days I prefer to take work home. This solution also helps when I travel, because many friends and family have Macs.

I want to know exactly how the "reopen windows" on shutdown, functions (and what makes a different mac not want to open windows from the previous shutdown, but chooses to open from it's own previous shutdown), so I can look to write a script to make this work.
 

theSeb

macrumors 604
Aug 10, 2010
7,465
1,874
Now-here
The reason why you are seeing the behaviour you described is because Mac OS stores these preferences by host.

Open terminal and cd to ~/Library/Preferences/ByHost or use Finder which can also get into the hidden files with some gentle persuasion

On your drive you will see two sets of the same files (com.Apple.whatever.UUID.plist) with different UUIDs in the file name. In your case you should have two different UUIDs. These are the hardware UUIDs for each machine.

I believe that the file that stores the windows open info is com.apple.loginwindow.UUID.plist and you will obviously have two of them

In my screenshot I first looked at the file and then opened Safari and Calendar and indeed they were added.

Doing some quick solutioning in my head I reckon all you need to do is find a way to keep the information in those two files synced using the last modified one as the true source, since that's the last one you used. So every time you log on have a script run at startup to copy the last modified one (most recent modified date) into the other plist file. That should work, but I would suggest thinking through all of the different potential scenarios and ensuring that your script covers those. Also note that these are by user by host since I went into ~/Library

Screenshot 2020-10-27 at 12.04.58.png


Disclaimer: I am not an Apple software engineer :) Make sure you have a backup before messing around.
 
Last edited:
  • Like
Reactions: virtualp

virtualp

macrumors newbie
Original poster
Sep 3, 2020
5
0
The reason why you are seeing the behaviour you described is because Mac OS stores these preferences by host.

Open terminal and cd to ~/Library/Preferences/ByHost or use Finder which can also get into the hidden files with some gentle persuasion

On your drive you will see two sets of the same files (com.Apple.whatever.UUID.plist) with different UUIDs in the file name. In your case you should have two different UUIDs. These are the hardware UUIDs for each machine.

I believe that the file that stores the windows open info is com.apple.loginwindow.UUID.plist and you will obviously have two of them

In my screenshot I first looked at the file and then opened Safari and Calendar and indeed they were added.

Doing some quick solutioning in my head I reckon all you need to do is find a way to keep the information in those two files synced using the last modified one as the true source, since that's the last one you used. So every time you log on have a script run at startup to copy the last modified one (most recent modified date) into the other plist file. That should work, but I would suggest thinking through all of the different potential scenarios and ensuring that your script covers those. Also note that these are by user by host since I went into ~/Library

View attachment 974890

Disclaimer: I am not an Apple software engineer :) Make sure you have a backup before messing around.
Thanks - this works! I just had to copy the file into the other. I will try to create a soft link to see if that's enough for future.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.