situation: you have recently installed a kext or some bundle that update your OS X, after reboot the system will not load and the "Gray Apple screen" displayed forever ("system Hangs at boot").
another option is: that you get a Kernel Panic message (A.K.A SOD Screen Of Death).
Solution: the solution is to first find what preventing your system from loading and fix it, or disable its load. another approach is to reverse the install of the causing problem (the kext or the bundle...)
Find out what is wrong (getting access to your system so you can try to fix it):
1. boot your computer, press F8 continueslly until you see the Darwin boot prompt
2. if you got to here then your partition is bootable, if not (try several times) then goto restore bootable partition post.
3. next write at the prompt "-v" (without the quotation marks) this will boot the OS without displaying the "Gray Apple Screen", but it will display log lines instead (A.K.A verbose mode).
5. in this mode you can see all the steps that the OS is taking in order to load, you will see kext load, bundle loaded, errors and warnings that will appear.
6. you need to search lines that looks like an error, usually contain the words "error" or "exception" in it, you should also search for the word "Panic" it means that the OS cannot continue after this point, when you find such lines read several lines before them and several lines after them (if they exist), they will tell you more what has happened or what is missing, or failing. check these Panic examples to get the idea.
7. write the lines you suspect and google for them, or you already know that they are regarding the kext or bundle you installed.
8. next reboot but this time write at the prompt "-s -f -x -v" (without the quotation marks) this will try to boot the OS into safe mode and single user for more details on the procedure goto "Boot into Single User" post.
9. if you got to this point, then your system can be launch but during GUI launch (or kext load) it fails (go to next step). if not then goto "Access OS X files externally" post and restore the backed up files prior to the recent installation, if you haven't backed up your files, then try to rename the installed files (that probably cause the panic) so the OS can't load them, and boot (in some cases it will work).
10. if you got this far then you are in a better shape then it looks now go to "fix solutions" and try them, after every "fix solution" you should try rebooting to test if the fix is enough for booting the OS, if not then press on to the next solution, if you are out of solutions then you can try one of two things: comment this article for help, or re-install, ofcourse there is always google.
Fix Solution 1:
this first solution tries to fix unix permissions for all the files on the disk,
from the command line prompt write:
diskutil repairPermissions diskXsY
where X stands for your disk number (starting from 0) and Y stands for your partition number (starting from 1), example: first primary disk on the second partition will look like this: disk0s2.
this should take a while, at the beginning you will see indication that the check has started like this: Started verify/repair permissions on disk disk0s2 Leopard
next you will see a text progress indication looking like this:
[ | 0%..10%..20%......................................... ]
if there are permission fixes you will see an indication looking like this:
Group differs on "Applications/.DS_Store", should be 80, group is 501
User differs on "Library/Internet Plug-Ins/flashplayer.xpt", should be 0, user is 501
at the end the progress will reach 100% and there will be an indication looking like this:
[ + 0%..10%..20%..30%..40%..50%..60%..70%..80%..90%..100% ]
Finished verify/repair permissions on disk disk0s2 Leopard
Fix Solution 2:
this fix procedure suggest to simply restore the backed up files (you should always save the kext you are about to install, i usually rename it to kextName.old and this way i can always come back to it, even if i find out in a week that there are problems with the new kext). in order to restore from single user mode do this (replace KextName with the kext name you want to restore):
mv KextName.kext KextName.bad (this will rename the bad kext)
mv KextName.old KextName.kext (this will rename the backed up kext and set it as current)
chmod -R 755 KextName.kext (this will set the correct permissions)
chown -R 0:0 KextName.kext (this will set the ownership on files to system user (root))
rm /System/Library/Extensions.mkext (this will reset all kext caching done by OSX)
Fix Solution 3:
if you don't have a backup or the restore did not help, then the next step suggest to remove the kext/bundle/demon/application from being loaded at all, Note this will work only with non essensials files, for instance if you remove the GeForce.kext or ATIx1000.kext it is ok if you have more kext files (like default VESA driver) to take care of load generic driver, or if you get rid of PS2 or bluetooth it is ok since the max harm their absents can cause is no mouse/keyboard or no bluetooth but system will still load, but if you try to remove AppleSMBIOS.kext or AppleACPIPlatform.kext then the system will probably will not even boot into single user mode again.
so in order to rename your kext do this:
mv KextName.kext KextName.bad
Fix Solution 4:
if you don't have a backup, you can try to download the kext file from the web, or extract it from the install ISO or DVD using pacifist application, or you can install a fresh copy on a different hard drive or different partition or different computer and extract the required kext from there or even the whole extensions folder.
Fix Solution 5:
some times the hang can be caused by an application or a configuration panel you installed that alter the default preferences of the OS, the way to reset it is to remove the preferences files that the application is installing and the OS will read the values from its defaults system.
in order to do that rename the files you suspect (using the mv command like before), they can be found at these folders:
/Library/Preferences/SystemConfiguration (system wide configuration files)
/Library/Services (installed services)
/Library/StartupItems (items that loads with the system)
/System/Library/LaunchDaemons (this folder contains all the demons started at boot time)
/System/Library/LaunchAgents (this folder contains all the agents started at boot time)
/Library/LaunchDaemons (this folder contains all the demons started for root user)
/Library/LaunchAgents (this folder contains all the agents started for root user)
/System/Library/SystemConfiguration (system wide configuration files)
/Users/[some user name]/Library/Preferences (preferences for specific user)
Fix Solution 6:
this solution is one step before considering re installing the OS, but it can be long and you will need another mac, the solution is to reinstall the kext/bundle/application again, perhaps the copy/install did not fully succeed. if you have installed a package file with mpkg/pkg extension then that mpkg is a folder containing folder named Packages inside it that contains all the pkg files to be installed, the pkg file is also a folder that contains archive gzip, and a set of scripts telling it what to extract and where to copy the files (there can be many places not just one directory).
if you want to manually install (or check what files where copy during the install and remove them or make sure they have been copied) then you should take the time to extract all the archive files, list the files, find them on the disk and overwrite them, or remove them.
this procedure is recommended only if you have a small list of files, there can be even a small mistakes that can cost hours of work, but what i do recommend to do before installing such a package (if it is core related like bluetooth, or airport update etc.) then do the same procedure, and find the files that are going to be replaced and back them up. you can also use pacifist on the "bom" file (next to the archive file) and see the files and folders in there.
another way is to find out what packages are already installed on your machine (and maybe uninstall the problematic) this can be done from the command line using "pkgutil" write it and press enter and you will see the help screen, you can also look inside the folders named: "Receipts" that save the pkg installed in the appropriate volume, these folders can be found:
/Users/[some user name]/Receipts
if the first verbose mode boot did not help in understanding the problem then you can search for a clue in the system log files, these log files reside in these locations:
/Users/[some user name]/Library/Logs
Enjoy (hope this will help you).