Open Safari Without Opening Windows From The Last Session

Oct 11, 2015

 

How to open Safari without automatically re-opening windows/tabs from the last session. This can save you if you ever run into ransomware. 

 

Earlier in the year a co-worker got caught up in a kind of ransomware scam. She was using her Macbook, when it suddenly seemed to freeze up, displaying a message that it was urgent she call Apple technical support immediately. The number was provided.

She called, and the agent explained that they would need to connect to her machine and take a look. She co-operated and, after a quick review, gave her some bad news. He assured her that her computer was loaded with malware and spyware, and that foreign hackers were logging her keystrokes, capturing her banking passwords, etc.

The good news was that he could quickly fix the problem. The bad news was that her computer was no longer under warranty, and she would have to pay $500. It was expensive, but cheaper than having hackers drain her bank account, so she happily paid it.

Unfortunately the entire thing was a scam. She wasn't talking to Apple support, but an imposter. The program that froze her Macbook and instructed her to call them? It was also designed by them for this very purpose. And, while they claimed to fix her computer, they actually took the opportunity to load it up with even more malware and spyware.

There is a happy ending. She took the machine to an Apple store, who did fix it completely and at no charge. She also disputed the $500 charge with her credit card company and had it reversed.

Unfortunately it continues. Recently another friend encountered something very similar, but they were able to figure it out a little sooner. They visited a page with Safari, which suddenly froze up and displayed a message to call Apple support. He called the number, but immediately realized it was an imposter and hung up.

The machine was still largely unusable though. He could "un-freeze" it by force-quitting Safari, but as soon as he restarted Safari it attempted to open the tab that was causing the problem – refreezing the machine again.

How could he restart Safari without it automatically opening the tab that was causing all of the problems? There are a few different options:

 

Terminal

This isn't the easiest (or least intimidating) option, but it is a great way for most users to get a little outside their comfort zone and try the incredibly powerful Terminal application.

Simply launch Terminal (Applications > Utilities > Terminal), copy the line below (exactly) and hit return:

 

defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false

 

This changes the Safari preference without opening Safari. It's like launching Safari and changing the preference manually, but without actually launching Safari and creating the problem.

It's also a good opportunity to learn a little bit about Terminal and UNIX. Let's take another look at the line we pasted:

defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false

"write" means that you are making a change to the Safari defaults, not just reading them. The "-bool false" part is what you are actually writing – you are telling it to not keep windows open automatically.

With just a few small changes you can instead see the saved value. Paste this line into Terminal, and it will tell you what the default setting is currently:

 

defaults read com.apple.Safari NSQuitAlwaysKeepsWindows

 

The number 1 means "true", that Safari will automatically attempt to reopen all windows at launch. A zero means "false", and it will not.

You can see it all in the screenshot below. On launching Terminal it creates a new window with a prompt. In this case that reads "Mark-Anderson-MacBook-Pro:~ mark$" indicating the machine and user. In your case those details will be different.

set-safari-preferences-by-terminal.png

The line defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false is pasted to the right of this, and hitting return enters it. The machine responds with another prompt, which can be a little disconcerting, it looks like nothing happened.

You then confirm you got the change you wanted by entering the line defaults read com.apple.Safari NSQuitAlwaysKeepsWindows. This returns a zero, or false, meaning that Safari will not automatically try and re-open any windows, including the one that is causing the problems.

 

Command/Option Keys

This is arguably a little bit easier, but you won't learn anything about Terminal or UNIX.

Safari cannot be open for this to work. If it is open you need to quit, or force quit, before proceeding.

Now launch Safari again, but hold down one of the Command (the keys to the immediate left and right of the space bar, usually with an Apple icon and four leaf clover) and one of the option keys (usually beside the Command keys) while you do it.

If this doesn't work it is usually because of the timing. You need to be holding a Command AND Option key down before you launch Safari, and keep them pressed while it launches.

If you get the timing right it will open a new empty window, avoiding the site/window that was causing the problem.



Tags: Security

Related Content

How To Migrate Google Authenticator To A New iPhone

Instructions on how to move Google Authenticator to a new iPhone so you don't lose access to accounts with two-factor authentication enabled.

Why Have Security Questions After Password Authentication?

Asking security questions after password authentication is not just pointless, it actually makes things less secure.

How To Securely Hide (and Encrypt) Files On Mac OS X

How to hide/secure files on your Mac: An easy approach to protecting your data by securing, hiding, and encrypting selected files and folders in Mac OS X.

Security Through Obscurity On Mac OS X – Better Solutions

A look at how security through obscurity (hiding files) is doomed to fail in Mac OS X, plus a look at some easy ways to truly secure files on your Mac.

Showing Hidden Files vs Hiding Regular Files in Mac OS X

They might seem like flip sides of the same coin but the techniques used to show hidden files on a Mac are not the best solution for securely hiding files.

What Does Incognito/Private Mode Really Mean?

The incognito or private mode in your web browser can offer you some additional privacy but not as much as you may think, and you still need to be careful.

"Your Apple Device has been locked..." Another Scam

Does "http://www.alerts-safari.info" say "Your Apple Device has been locked, due to security reasons"? Don't panic, it's not – just don't call the number!

Short Guide to (Finding, Sharing, etc.) SSH Keys on Mac OS X

A short guide to SSH keys and Mac OS X: How to create, find, share and add SSH Keys (and deal with related SSH errors and warnings) on Mac OS X.

Multi-Factor Authentication With Google Authenticator

Using Google Authenticator to increase digital security through the use of multi-factor authentication.

What is Multi-Factor Authentication?

Understanding the concept of multi-factor authentication really isn't that hard, but it is an important step towards better digital security.

Category List


Tag List


Tag Cloud



Archive