Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to replace a broken Desktop folder Desktop
I managed to "break" the desktop folder on our macbook. I'm not sure exactly how it happened, but I'd started to copy an application to the desktop using Terminal, and then thought it wasn't working so quit the copy. Every time I clicked on the Desktop in the Finder, the Finder would thrash and other applications became uncooperative. Clicking on Desktop in the home folder or in the sidebar led to the message that 'there is no default application to open the document "Desktop"...,' which was rather worrying. I managed to copy the folders on the desktop to the home folder, so it was empty but still broken, and anything saved to it would go who-knows-where.

I was thinking I might have to do an archive-and-install, which would have been a pain, but then I remembered seeing Apple's article on how to change a user's short name, which involves copying the files from one home folder to another. So I created a new user 'test' and got to work.

Here's how I solved it, while logged in to the troublesome account. In Terminal, I ran these two commands (where myuser is the short username for the troublesome account):
$ sudo cp -R /Users/test/Desktop /Users/myuser/Desktop
$ sudo chown -R myuser /Users/myuser
This would, of course, delete anything left on the desktop if it wasn't empty, so use with care (have you backed up lately?). I could probably have used cp in Terminal to copy things out of the desktop first, if it wasn't empty already. I'm not sure what caused this problem, but this has solved it. Possibly it was some sort of permissions problem, or the Finder was seeing the desktop as a package from the failed copy command.
  • Currently 2.00 / 5
  You rated: 2 / 5 (5 votes cast)

One way to replace a broken Desktop folder | 11 comments | Create New Account
Click here to return to the 'One way to replace a broken Desktop folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to replace a broken Desktop folder
Authored by: mpanighetti on Oct 09, '07 08:55:24AM

I might have tried to simply throw the old Desktop folder in the Trash, then log out and in again; OS X will automatically create a new Desktop folder.

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: Aegir on Oct 09, '07 09:01:28AM

Before doing all this you checked of course that the file mode of the Desktop directory was correctly set to 700?

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: nicholfd on Oct 09, '07 09:37:28AM

$ sudo cp -R /Users/test/Desktop /Users/myuser/Desktop
$ sudo chown -R myuser /Users/myuser

The above commands delete no files. I suspect, it also does not achieve what you think.....

The first command above will place a copy of "/Users/test/Desktop", INSIDE of "/Users/myuser/Desktop/". It will be called "/Users/myuser/Desktop/Desktop"

I suspect you did, or meant to do a:
'sudo cp -R /Users/test/Desktop /Users/myuser/'

This still would not delete any files, but would duplicate the CONTENTS of "/Users/test/Destkop/" inside of "/Users/myuser/Desktop/". Again, anything inside of "/Users/myuser/Desktop/" WOULD NOT BE TOUCHED, unless a file or directory existed with the same name as a file or directory from "/Users/test/Desktop/".

Clear as mud? The above subtitles are very important when working from the command line.

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: lincd0 on Oct 09, '07 09:53:58AM

It sounds like you somehow replaced the Desktop folder with a file. You don't need to use administrator privileges to fix this.

rm -r Desktop
mkdir Desktop

If that doesn't work, your disk directory is hosed and you need to repair it or reformat. Sudo is dangerous unless you really, really know what you're doing.

[ Reply to This | # ]

One way to replace a broken Desktop folder
Authored by: lab2010 on Apr 24, '10 02:28:20AM

I had the same problem. The commands

rm -r Desktop
mkdir Desktop

worked like a charm. Thanks.

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: mclbruce on Oct 09, '07 10:52:23AM

I agree with mpanighetti

1. Delete the desktop folder. Use terminal to do this if necessary.
2. Log out
3. Log in

The OS X hints are not what they used to be. I guess this is because this site is doing it's job too well. Well done, How about reducing your daily hints quota or taking some time off until Leopard is released so that you don't dilute your brand and reputation.

[ Reply to This | # ]
Other broken folders
Authored by: nickp on Oct 09, '07 05:38:22PM

I have been seeing a (potentially) related problem:

Certain folders have become wedged such that they hang the finder (requiring relaunching) whenever I try to view them sorted by date or kind.

Other folders require 30 or more seconds to open, even though they have only a few hundred files in them. I tried fixing permissions ...

I have no idea what's going on. Any suggestions?

[ Reply to This | # ]
Did you try reboot, cmd-S, fsck -y?
Authored by: Lectrick on Oct 10, '07 09:13:17AM

This looked like a corrupted filesystem to me.

I would have rebooted, held down command-S to go into singleuser mode, then typed fsck -y, waited, if errors then repeat fsck -y until none, then "exit" to go to the mac GUI. ;)

Then run repair permissions in disk utility.

In /dev/null, no one can hear you scream

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: dethbunny on Oct 10, '07 02:09:48PM
Unless the folder was somehow transmogrified into a file (which doesn't happen) it's very likely you had a corrupt ".DS_Store" file. Occasionally Finder will create a .DS_Store that makes itself crash, or the file may become spontaneously corrupted.

You should have been able to simply type the following in Terminal to solve the problem if that was the case.
rm /Users/myusername/Desktop/.DS_Store
I have seen problems with those hidden files more than once. In one case, it was almost "viral" in nature. If you opened a folder (Folder A) that was okay, and opened another (Folder B) that crashed the finder, opening Folder A in the future would also crash the finder. This made clean-up rather difficult. I used the "find" command to delete every .DS_Store file on every mounted disk, which solved the problem. The side-effect of doing this is that all your finder views will be reset, but no loss of file data occurs. The find command was:
sudo find / -name ".DS_Store" -exec rm {} \;
If you only want to clean up a specific user's home folder or only a specific drive, change the first argument of the find command. For example:
find /Users/myusername/Desktop -name ".DS_Store" -exec rm {} \;
sudo find /Volumes/FireLite\ 100 -name ".DS_Store" -exec rm {} \;
This can also be used to remove other files that are spread out and annoying - it's invaluable for cleaning up extra "Thumbs.db" files when copying images from Windows - but be cautious. There is no Trash; there is no undelete. As with all things in Terminal, punctuation, spacing, and capitalization counts. If you don't understand why a command works, it's best not to be using said command.

[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: bdm on Oct 11, '07 06:20:07PM

As other posters have pointed out, you probably have more troubles than you realise. However, to comment only on your original suggestion: add the -p switch to cp command so that ownership, permissions and dates are preserved. Then you don't need the chown command.


[ Reply to This | # ]
One way to replace a broken Desktop folder
Authored by: mahakali on Oct 12, '07 12:47:54PM

Or just rename the desktop

mv ~/Desktop ~/Desktop_old

Logout and relogin.

[ Reply to This | # ]