MacOS – OSX El Capitan reset the number of Spaces

macosmission-controlspacesterminal

Is there a way of "resetting" the number of desktop Spaces in Mission Control in El Capitan?
I'm working on a previous co-workers Mac Pro, and somehow mission control has….325 desktop Spaces…

enter image description here

I have already tried disabling/re-enabling Spaces via terminal with…

defaults write com.apple.dock mcx-expose-disabled -bool TRUE
killall Dock
defaults delete com.apple.dock mcx-expose-disabled
killall Dock

…however the previous number of spaces persists. I have also tried disabling all of the Mission Control System Preferences but to no avail.

Is there a terminal command that will set the number of spaces available?

Best Answer

The list of spaces is stored in the following file.

/Users/YOURUSERNAME/Library/Preferences/com.apple.spaces.plist

For example on a machine with the dashboard and three desktops:

<key>Spaces</key>
<array>
    <dict>
        <key>ManagedSpaceID</key>
        <integer>3</integer>
        <key>id64</key>
        <integer>3</integer>
        <key>pid</key>
        <integer>59241</integer>
        <key>type</key>
        <integer>2</integer>
        <key>uuid</key>
        <string>dashboard</string>
    </dict>
    <dict>
        <key>ManagedSpaceID</key>
        <integer>1</integer>
        <key>id64</key>
        <integer>1</integer>
        <key>type</key>
        <integer>0</integer>
        <key>uuid</key>
        <string></string>
        <key>wsid</key>
        <integer>1</integer>
    </dict>
    <dict>
        <key>ManagedSpaceID</key>
        <integer>4</integer>
        <key>id64</key>
        <integer>4</integer>
        <key>type</key>
        <integer>0</integer>
        <key>uuid</key>
        <string>514D761A-D08B-402E-BF8E-FFB607A340EF</string>
    </dict>
    <dict>
        <key>ManagedSpaceID</key>
        <integer>5</integer>
        <key>id64</key>
        <integer>5</integer>
        <key>type</key>
        <integer>0</integer>
        <key>uuid</key>
        <string>CF552E87-9A59-41C7-B0AF-7AEFFB1DFB43</string>
    </dict>
</array>

Unfortunately OS X holds a copy of the file in memory, so if you just delete it or modify it, it doesn't make any difference as it just recreates the file with the same number of spaces.

You could log into another account, delete the file from the Terminal, and then log back into the affected account.

Or you could just create a new account for yourself and use it, and leave the 325 spaces for your colleague if they return. Each user account has its own com.apple.spaces.plist file.