Photo Booth Plist Rebuild/Repair Script
- Comments:
- 16
Note for Apple Silicon Macs: I've found that the ~/Pictures/Photo Booth Library directory can only be modified through Apple's built-in Terminal.app. Alternative terminal applications such as Ghostty and iTerm appear unable to modify its contents, for reasons I have yet to determine.
You may also need to enable Developer Mode in Terminal.app to execute the script. See my guide on running unsigned binaries in macOS Terminal for instructions.
When I switched from an older MacBook Pro to a MacBook Air the backup from my old MacBook Pro was corrupted and unmountable. However, I had preserved a backup of my Photo Booth Photos and wanted the Photo Booth application to recognize them. This is just a matter of creating a Recents.plist, an ordered list of the image files.
While adding these photos to the Recents.plist file Photo Booth uses seems straightforward enough, arranging hundreds of photos from different naming schemes across various OS versions manually is pretty tedious.
To fix this, I wrote a script that automatically creates a new plist file with the photos in the correct order. As a safety measure, the script backs up the existing Recents.plist as Recents.plist.bk.[time], allowing easy restoration if needed.
Usage
PHP Requirement
This script is compatible with macOS versions through macOS 27 (Golden Gate).
The script requires PHP, which is no longer bundled with macOS. If you do not already have PHP installed, you will need to install it separately.
I recommend using Homebrew to install PHP.
After setting up Homebrew, install PHP by entering the following command:
brew install php
To Begin With
- Ensure all photos and movies you want loaded into Photo Booth are located in your
~/Pictures/Photo Booth Library/Pictures/folder. - Ensure the Photo Booth application is closed to avoid overwriting our changes.
- On Apple Silicon Macs, use Apple's built-in Terminal.app rather than Ghostty or iTerm if you encounter permission issues.
Simple Method
Added September 10, 2012
Open Terminal and run the following command.
curl -Ls https://gist.githubusercontent.com/donatj/1108691/raw/Photobooth_rebuild.sh.php | php
Git Method
Clone the repository, then execute the script using PHP.
git clone https://gist.github.com/1108691.git PhotoBoothRepair
cd PhotoBoothRepair
php Photobooth_rebuild.sh.php
Non-Git Method
-
Save the script somewhere accessible to you via Terminal.
-
Navigate in Terminal to the directory where you saved the script.
-
Set the file executable by running:
chmod +x Photobooth_rebuild.sh.php -
Execute the script:
./Photobooth_rebuild.sh.php -
All done! Fire up Photo Booth to see the results!
Known Limitations
- All Leopard format names will come first regardless of date simply for lack of anything to go on. They're just numbered and contain no date information.
Comment by: Mark on
Comment by: Jesse G. Donat on
This guide looks pretty useful for getting you up to speed on basic Terminal usage, I hope it helps.
Comment by: Jon Zantua on
Comment by: Kris on
Comment by: Scott Kennedy on
Comment by: Logan on
Comment by: Austin on
AWMBP:~ austinwismer$ chmod +x Photobooth_rebuild.sh.php
AWMBP:~ austinwismer$ ./Photobooth_rebuild.sh.php
-bash: ./Photobooth_rebuild.sh.php: /usr/bin/php: bad interpreter: Operation not permitted
Comment by: FC on
Comment by: Pierre Wygant on
//Cheers
Comment by: Jesse G. Donat on
I had to update the script a bit. Apple apparently made a tiny change to the filename format in macOS Tahoe, replacing the regular space between the time and AM/PM with a non-breaking space. That was enough to break my existing sorting logic. 🙄
The script has been updated to handle both formats. I've also added some notes about Apple Silicon near the top of the article, so be sure to read those!