First suggestion:
In Disk Utility (Application -> Utilities -> Disk Utility), run "Repair Disk Permissions", note that this will only fix SYSTEM level applications and files. OSX maintains an expected permissions state file, and references it when you Verify/Repair Disk Permissions.
Again, this will recover the most essential things, but not applications/files you've put there yourself, nor your home directory contents, etc.
Second suggestion:
Backup what's important, re-install.
There's no way of "undoing" a chmod,sshort of going through a known-good installation and checking/reproducing permissions. The easiest way out for you is a complete re-install.
As Jason says, Disk Utility should get most of the OS's stuff. For the rest, perhaps you could assume defaults of 644 for files, 755 for directories, except in /Users where 600 and 700 might be more appropriate? This won't put everything exactly as it was, but it should keep most stuff working and you can fix up special cases as you find them.
The best order would probably be
chmod -R 644 / # Set everything to owner read/write, others read chmod -R a+X / # Add execute for all on directories
Then run the Disk Utility to let it patch up what it can on top of those base permissions.
I assume the Disk Utility will do things like making the contents of /bin executable.
This all off the top of my head and untested; I'd recommend testing the chmods on a small subtree before running them across the whole disk.
If you can reinstall that might be better for longterm peace of mind. I'd happily perform a kludge like this on one of my test boxes, but maybe not on my personal workstation.
You won't be able to fix it for everything.
First suggestion:
In Disk Utility (Application -> Utilities -> Disk Utility), run "Repair Disk Permissions", note that this will only fix SYSTEM level applications and files. OSX maintains an expected permissions state file, and references it when you Verify/Repair Disk Permissions.
Again, this will recover the most essential things, but not applications/files you've put there yourself, nor your home directory contents, etc.
Second suggestion:
Backup what's important, re-install.
There's no way of "undoing" a chmod,sshort of going through a known-good installation and checking/reproducing permissions. The easiest way out for you is a complete re-install.
As Jason says, Disk Utility should get most of the OS's stuff. For the rest, perhaps you could assume defaults of 644 for files, 755 for directories, except in /Users where 600 and 700 might be more appropriate? This won't put everything exactly as it was, but it should keep most stuff working and you can fix up special cases as you find them.
The best order would probably be
chmod -R 644 /
# Set everything to owner read/write, others readchmod -R a+X /
# Add execute for all on directoriesThen run the Disk Utility to let it patch up what it can on top of those base permissions.
I assume the Disk Utility will do things like making the contents of /bin executable.
This all off the top of my head and untested; I'd recommend testing the chmods on a small subtree before running them across the whole disk.
If you can reinstall that might be better for longterm peace of mind. I'd happily perform a kludge like this on one of my test boxes, but maybe not on my personal workstation.
Pete