Useful macOS defaults: Sidebar Lists
com.apple.sidebarlists controls which items appear in the Finder sidebar. The sidebar is the left panel in every Finder window, showing your favourite folders, drives, network locations, and tags.
How the sidebar works
The Finder sidebar has several sections:
- Favourites: folders you use often (Desktop, Documents, Downloads, and so on)
- iCloud: iCloud Drive and shared folders
- Locations: your Mac, external drives, network drives, and disc images
- Tags: colour tags for organising files
You can drag items in and out of the sidebar by hand, and you can control which sections appear in Finder, then Settings, then Sidebar. But some things are easier to script.
The problem with scripting the sidebar
Apple stores the sidebar configuration in a binary property list, which makes it hard to edit with simple defaults write commands. The data structure is nested and includes unique volume identifiers.
For most sidebar changes, the simplest approaches are:
Using Finder Settings (the graphical way):
Open Finder, press Command Comma, and click the Sidebar tab. Tick or untick items.
Using the mysides command-line tool (for scripting):
mysides is a small open-source tool that makes sidebar management easy from the terminal. You can install it with Homebrew:
brew install mysides
Then manage sidebar items:
# List current sidebar items
mysides list
# Add a folder to the sidebar
mysides add Documents file:///Users/yourname/Documents/
# Remove an item from the sidebar
mysides remove Documents
# Add a network server
mysides add "File Server" smb://server.local/share
Show or hide the sidebar sections with defaults
You can control whether Finder shows certain items in the sidebar through the Finder domain rather than the sidebar lists domain:
Show connected servers in the sidebar:
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
Show removable media:
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
Reading the current sidebar configuration
You can read the raw sidebar data:
defaults read com.apple.sidebarlists
The output is a nested structure with arrays of dictionaries. Each entry has a name, a type, and a reference to the item. This is useful for inspecting the current setup but not practical for editing by hand.
Adding items with Python (advanced)
If you need to script sidebar changes without installing extra tools, you can use Python with the CoreFoundation framework. But for most people, mysides or the Finder Settings panel is the better choice.
Notes
The sidebar configuration is stored per user. Changes only affect the current user account.
After changing sidebar settings through the command line, you may need to restart Finder:
killall Finder
Enjoyed this post?
Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.
Tags
Category:
Tags:
Year: