myFix 1.0 (pfix 4.0)

This version is now deprecated, consult the downloads page for a link to the latest version.

This is a complete rewrite of the pfix utility and the beginning of something more. pfix 3.1 was a solid performer, I received no bug reports, but truth is it was a little messy. I had seen many issues with the way kextd/kextcache functions in Snow Leopard and users rebooting prior to the system prelinked kernel caches being completely built. So to ensure fail proof operation I coded it to build all of the caches manually, not just the Extensions.mkext. This wasn’t the ideal way to do things, but it required minimal time on my part to simply fix bugs in 3.0/2.x rather than rewrite it in a new format.

That said, with OS X 10.7 about to be officially released to the wild it was time for a rewrite, not only to clean up the old code but to expand functionality to the new version of OS X.

One of the biggest complaints I received about pfix 3.1 was that it took so long to execute… Why wait so long when you can just chown/chmod and then touch /System/Library/Extensions? Well the reason is simple really – it is not the fault of pfix – it is the fault of Snow Leopard’s kextcache. It takes a ridiculously long time to rebuild the system prelinked kernel caches if there is a problem with them or they don’t exist after having been deleted. If you were to simply touch /System/Library/Extensions and then reboot imediately, kextcache would not be finished and it will take you up to 15 minutes to boot your system, if it boots at all. Good news is, Lion doesn’t have this problem.

So what have I changed? Well not only will myFix detect the OS version it is running on, but it also detects the OS version of the target and adjusts the functions and syntax for mkext creation accordingly. I have extended support for it to run on Leopard and Lion. I have dropped support for running it on Tiger. I have also added full support for Leopard and Lion as target’s. So now you can use myFix from Leopard, Snow Leopard, and Lion to repair any Leopard, Snow Leopard, or Lion volumes.

Additionally instead of running all the commands manually I let kextd/kextcache do it’s job – after the initial permission repair (and optional diskutil repairPermissions) it will simply touch /System/Library/Extensions – and then it will WAIT until kextcache is finished. In some cases it will still take a while for kextcache to finish, but by waiting it will let you, the user, know when it’s safe to reboot so that you do not reboot your system prematurely and have a problem. In most cases however it will actually finish quite quickly. By adding the optional flag to skip the diskutil repairPermissions step it will go even faster, however, I do suggest you let diskutil repairPermissions run as chmod 0755 is *NOT* the correct permissions for many of the files in /System/Library/Extensions.

What did I mean by “and the beginning of something more”?

myFix will be more than simply a Permissions & Caches utility. In the future I will be adding additional functions to myFix, backup/restore functions, kernelcache support via bundled SLE extension, chameleon repair/updating, and more are all on the todo list…. Stay tuned…

So without further adieu let me present you with myFix 1.0

Basic Usage: myfix [option]
Example Usage: myfix -v 1 -t /

Option       GNU long option       Meaning
-h           –help                Show this message
-s           –skipsystem          Don’t repair /system/library/extensions
-d           –skipdiskutil        Don’t repair permissions with diskutil
-v <level>   –verbose <level>     Set kextcache output’s verbosity level
-t <path>    –target <path>       Path to target partition to run myfix on

A complete list of the changes to the pfix functions from pfix v3.1 are as follows:

  • -Completely re-written from scratch with much cleaner syntax and improved functionality
  • -Target OS version detection
  • -Added skip diskutil repairPermissions flag
  • -Added support for OS X 10.5 Leopard and OS X 10.7 Lion targets
  • -Improved support for OS X 10.6 Snow Leopard
  • -Removed support for OS x 10.4 completely

pfix v3.1 Released

This version is now deprecated, consult the downloads page for a link to the latest version.

This release corrects a minor bug that was reported by several users when pfix was run under OS X 10.5.x “Leopard”. I took the opportunity to clean up a few other things while I was at it.

Changelog:

v3.1:

  • -Corrected minor syntax errors for correct operation of pfix under OS X 10.5.x “Leopard”.*
  • -Improved syntax usage to adhere to expected syntax and ensure error free operation in the future.
  • -Corrected minor typo and altered some of the displayed information for clarity.

v3.0:

You may review the full v3.x release notes here.

* When pfix 3.0 was run under OS X 10.5 “Leopard” it was reported to display an “kextcache: illegal option — q” error. Apparently the -q “quiet” option either does not function correctly or is not available on the previous version of kextcache that is available under Leopard. As a result completely quiet operation has been disabled when pfix 3.1 is running under 10.5, it will simply use -v 0 (lowest verbose mode) instead. If you desire a different level of verbosity use the -v # flag as described in the pfix –help output. (# being any number between 0 and 6 as described in the man page for kextcache).

pfix v3.0 Released

This version is now deprecated, consult the downloads page for a link to the latest version.

This is a complete rewrite of the pfix utility. In my last few revisions of the 2.x branch a number of potential problems were revealed to me. Of the reproducible errors – errors due to problems with kextd were the main culprit, even when forced rebuilding of kextcache was done. Though failures such as these were limited to a small number of end users any failure of pfix is unacceptable to me. After extensive testing of many different new methods to resolve all of these issues pfix 3.0 is ready for public release.

This version will take longer to execute than previous versions when correcting permissions and rebuilding caches for a root system volume but it will do so with virtually no possibility of errors. If all you are doing is swapping around a few kexts in /Extra however I have introduced a flag to skip the repair of the system permissions and caches for a very quick operation. Additionally pfix is now designed to operate from /usr/sbin/ like a standard *nix utility and includes a usage output viewable by running “pfix –help” (without the quotes) from a terminal.

Basic Usage: pfix [option]
Example Usage: pfix -s -v 1 -t /

Option       GNU long option      Meaning
-h           –help                Show this message
-s           –skipsystem          Don’t repair /system/library/extensions
-v <level>   –verbose <level>     Set kextcache output’s verbosity level
-t <path>    –target <path>       Path to target partition to run pfix on

A complete list of the changes in v3.0 are as follows:

  • -Completely re-written and restructured code with much cleaner syntax and improved functionality
  • -Improved terminal log output information and format
  • -Added run time flags
  • -Added help flag and usage output
  • -Added skip system repair flag (if you only need to quickly repair /Extra)
  • -Added kextcache/diskutil verbosity flag (no verbosity by default [quiet])
  • -Added target flag (a list of available targets will be displayed by default)
  • -Debugged several functions for improved operation and log output when run from OS X installation devices.
  • -Now removes all system caches prior to rebuilding instead of only removing kext caches.
  • -Repair permissions using diskutil prior to rebuilding caches when targeting root partition. [no longer optional]
  • -Updates prelinked kernel cache & kext info caches prior to rebuilding system kext caches when targeting root.
  • -Created installation package to properly install pfix to /usr/sbin/ so that it is available from any terminal path.

pfix v2.7 Released

This version is now deprecated, consult the downloads page for a link to the latest version.

The changes I introduced in pfix v2.4 to reduce execution time (touching /S/L/E when pfix was targeting the root partition and kextd was running instead of forced regeneration of system caches with kextcache utility) apparently causes a problem for a small number of users. From what I have been able to find out this problem only seems to effect people running with a patched (non-vanilla) kernel. There is also the potential that this may effect people who are having issues with their running kextd process for one reason or another. Despite the fact that this problem would effect only a small number of pfix users the reduced execution time (30-90 seconds) is not worth it if pfix does not work for 100% of all users. So pfix will be reverted to manually regenerating system kext caches like it did in pfix v2.3 but the other improvements and enhancements found in pfix v2.6 will not be altered.

Changelog:

v2.7:

  • Bugfix: System kext caches regeneration has been reverted to forced kextcache method.

v2.6:

  • – Added feature which displays numbered menu instead of requiring user to type in volume manually.
  • – User is now prompted for password (if not already authorized with sudo) prior to script execution.

v2.5:

  • Bugfix: Corrected kextd test, if pfix is targeting a mounted volume and not the root [/] partition system caches will be rebuilt with kextcache.

v2.4:

  • – When running under OS X 10.6.x pfix now tests to see if kextd is running, if so it touches /S/L/E instead of rebuilding system caches with kextcache. This significantly reduces execution time.
  • – Repairing permissions with diskutil is now optional.
  • – Minor improvements to terminal output.

v2.3:

  • -If target is a mounted volume execute command to enable permissions on the volume prior to running pfix.

v2.2:

  • -A number of alterations/additions were made to enable proper functionality of pfix when it is launched from a USB Installer or Installation DVD.
  • -Log file is no longer written to disk, the log is displayed directly in the terminal window instead. This better informs the end user of what is happening and also prevents any errors from occurring if it is launched from a read-only location such as a USB Installer or Installation DVD.
  • -Improvements made to visual appearance of log.
  • -pfix version info now displayed in terminal before running any operations.

v2.1.1:

  • -Revised function to move CustomExtensions to Extensions to ensure smooth bug-free operation.
  • -pfix version now echoed to log file and terminal.

v2.1:

  • Bugfix: Corrected syntax error on kextcache command under Leopard.
  • Bugfix: Corrected minor error that could sometimes cause pfix.log to not be created.
  • -pfix.log now written to root [/] partition of the system it has been run on.
  • -Changed verbosity level of kextcache to 2 for additional useful information to be written to log.
  • -All kext caches are now removed prior to rebuilding.
  • -Minor alterations to output for additional clarity.

v2.0

You may review the full v2.x release notes here.

pfix v2.6 Released

This version is now deprecated, consult the downloads page for a link to the latest version.

This release adds two very nice new features to pfix.

Changelog:

v2.6:

  • – Added feature which displays numbered menu instead of requiring user to type in volume manually.
  • – User is now prompted for password (if not already authorized with sudo) prior to script execution.

v2.5:

  • Bugfix: Corrected kextd test, if pfix is targeting a mounted volume and not the root [/] partition system caches will be rebuilt with kextcache.

v2.4:

  • – When running under OS X 10.6.x pfix now tests to see if kextd is running, if so it touches /S/L/E instead of rebuilding system caches with kextcache. This significantly reduces execution time.
  • – Repairing permissions with diskutil is now optional.
  • – Minor improvements to terminal output.

v2.3:

  • -If target is a mounted volume execute command to enable permissions on the volume prior to running pfix.

v2.2:

  • -A number of alterations/additions were made to enable proper functionality of pfix when it is launched from a USB Installer or Installation DVD.
  • -Log file is no longer written to disk, the log is displayed directly in the terminal window instead. This better informs the end user of what is happening and also prevents any errors from occurring if it is launched from a read-only location such as a USB Installer or Installation DVD.
  • -Improvements made to visual appearance of log.
  • -pfix version info now displayed in terminal before running any operations.

v2.1.1:

  • -Revised function to move CustomExtensions to Extensions to ensure smooth bug-free operation.
  • -pfix version now echoed to log file and terminal.

v2.1:

  • Bugfix: Corrected syntax error on kextcache command under Leopard.
  • Bugfix: Corrected minor error that could sometimes cause pfix.log to not be created.
  • -pfix.log now written to root [/] partition of the system it has been run on.
  • -Changed verbosity level of kextcache to 2 for additional useful information to be written to log.
  • -All kext caches are now removed prior to rebuilding.
  • -Minor alterations to output for additional clarity.

v2.0

You may review the full v2.x release notes here.