Occasionally I like to take my macOS Photos Library and archive the photos elsewhere (typically S3, after some pre-processing).

When I do this, I like to delete my entire Photos Library and start again.

Unfortunately, macOS does not make this easy. The Photos app reacts badly to having the Pictures folder deleted. It will create the folder again when you open the app, but it may have trouble creating a new .photoslibrary folder inside Pictures.

It’s possible to get around this, but getting the “magic steps” just right can be a bit of a headache.

To save you some time, here are the steps I use.

Deleting everything Link to heading

First, you need to make sure you have closed toe Photos app, and that you have already exported any photos you want to save.

Warning: this will also clear the Photo Booth app.

Once you’re sure you’ve backed up all the photos you want to save, open a Terminal window and execute the commands below:

rm -rf ~/Pictures
rm -rf ~/Library/Preferences/com.apple.PhotoBooth.plist
rm -rf ~/Library/Preferences/com.apple.Photos.plist
rm -rf ~/Library/Containers/com.apple.Photo*
rm -rf ~/Library/Containers/com.apple.photolibraryd
rm -rf ~/Library/Containers/com.apple.Photos.librarychooserservice
rm -rf ~/Library/Photo*
mkdir ~/Pictures

Note: You might get some warnings about some of these files and folders not existing. That’s fine: not all of them will be present for all users.

Re-creating the Photos Library Link to heading

Next, hold down the option key while clicking on the Photos app from the dock (if it isn’t in your dock, add it to the dock first).

You’ll be greeted by the “What’s new” screen:

What’s new

Click on “Get Started”. You’ll then be asked whether you want to turn on iCloud Photos. I recommend choosing Not Now:

iCloud backup

You’ll then get an error about a missing Photos library. Click on “Open Other”:

Missing photo library

You’ll need to click “Create new” to create a new library:

Create new photo library

Give your library a unique name, like “JDPhotos”, then click “OK”:

New library name

You may get an error like this one:

Operation error

Photos will close. Simply reopen it (again with “Option + Left Click”) and try again. Once again, when the app opens you’ll see the library selection dialogue. Click “Create new” again:

Library chooser

Choose a different random name for your Photos library, then click “OK”:

New library (again)

Things should now be working!

Working Photos app

Now, close the Photos app and open up the Photos folder in Finder. Delete any Libraries you find:

Delete old libraries

Now, reopen the Photos app (this time, just left click, don’t hold down the “Option” key). Everything should be working normally:

Working normally again

Closing remarks Link to heading

Hope this helps somebody else! Photos can be a very “touchy” app, especially when it comes to cleansing it of all previous settings and data.