Donate Share

AppleJack:Troubleshooting Tool for Macs

File Release Notes and Changelog

Release Name: AppleJack 1.3

Notes:
APPLEJACK README
This is a shell script for cleaning up the mess left by system crashes: disk directory errors, buggy caches, corrupted preferences, etc. It is designed to be run only in single user mode. Running this script while logged in as a user can crash your OS (especially if you use it to delete the system's virtual memory or cache files), which would be more than a little bit counterproductive.


APPLEJACK REQUIREMENTS
1. Mac OS X 10.2.x or higher
2. The ability to type
3. The ability to read and follow instructions


INSTALLATION
A. Run the SimpleInstaller. (The installer seems to want to crash sometimes, especially if you run it from a disk image rather than from the local drive. Move the AppleJack installer folder to a local drive, and try again. If it still doesn't work: a#1. yell at me, and b#2.  try the steps below instead.)
-or-
B. If you want to install AppleJack manually, this is what the installer does. Modify to your taste:
if [ ! -d /private/var/root/Library/Scripts ]; then sudo mkdir /private/var/root/Library/Scripts; fi
sudo cp applejack.sh /private/var/root/Library/Scripts
sudo chmod 700 /private/var/root/Library/Scripts/applejack.sh
sudo chown root.wheel /private/var/root/Library/Scripts/applejack.sh
sudo echo "alias applejack='/var/root/Library/Scripts/applejack.sh'" >> /private/var/root/.profile
sudo cp applejack.8 /usr/share/man/man8/


APPLEJACK USAGE
1. You can type 'man applejack' in a terminal window for complete usage instructions.
2. Restart your computer. When the "bong" sounds, hold down the command and s keys until you get lots of text appearing on a black screen. You are now in single user mode. If you've used the installer, you should just be able to type 'applejack' at the prompt and be on your way.
2. Auto mode: You can let the script run through its tasks automatically by typing 'applejack auto' or 'applejack  auto reboot' (if you also want the machine to restart when finished).
3. Interactive mode: To run through just one task, or to run the script manually, type 'applejack' and then choose from the menu. Running the script in interactive mode has the added benefit of giving you options for working with user level cache and preference files, not just the default system level caches and preferences.
4. Corrupted preference files are moved into /Library/Preferences (Corrupt). After running AppleJack, you'll probably want to take a look at them (and most likely throw them out).
5. AppleJack now has a primitive logging mechanism. It writes a journal of its activity to /var/log/AppleJack.log. Please feel free to delete this file after you've looked at it. The log resets itself automatically whenever it reaches more than 500k in length.


KNOWN ISSUES:
1. The script relies on being able to find the swapdir variable in /etc/rc (although if it can't it will try to prompt you for its wherabouts). If you have altered /etc/rc, please make sure the swapdir variable is set in a way that can be read by the following command:
	swapdir=`grep -e "^[^#]*swapdir=[/\"']" /etc/rc | sed -e 's/"//g' | sed -e "s/'//g" | cut -f 2 -d =`
	if anyone knows a better way to get the value for this, please let me know. 

2. I've introduced a bug to the script: By using -zq%qz- as a place holder for spaces in preference file names, there will be problems in the unlikely event of a user having a preference file with -zq%qz- in its path or name. In general, due to limitations in my mastery over bash, there may be problems from time to time if you are working with filenames that contain special characters. If you run into such a case, please let me know so I can atttempt to fix it in an upcoming release. (Please see support/information below for a link where you can submit bugs.)

3. The initial lines of the each session's log do not have line feeds in them. I was not able to figure out how to insert 'permanent' line feeds into the temp log variable as they all seemed to just be converted to white space. I tried double escaping, and even hex ASCII values. Suggestions warmly welcomed.

4. Due to an Apple bug in diskutil, this script employs a workaround in order to run permissions repair on Mac OS X 10.3 (Panther) systems. I hope Apple will address this issue soon. Thanks to Josh Wisenbaker for the workaround (see below).


TO UNINSTALL:
Assuming you installed AppleJack as the default location, you can just copy the following shell script into a Terminal window, and hit return. If you've installed AppleJack at some other location, put that location in the script instead.
sudo rm -f /private/var/root/Library/Scripts/applejack.sh && \
sudo rm -f /usr/share/man/man1/applejack.1 && \
sudo sed -e '/[aA]pple[jJ]ack/d' /private/var/root/.profile > /tmp/profile.$$  && \
sudo rm -f /private/var/root/.profile && \
sudo mv /tmp/profile.$$ /private/var/root/.profile;


SUPPORT/INFORMATION
AppleJack Project Page on SourceForge: <http://applejack.sourceforge.net>. 
Sign up for the applejack-report mailing list to be kept abreast of developments: <http://lists.sourceforge.net/lists/listinfo/applejack-report>
AppleJack News: <https://sourceforge.net/news/?group_id=79562>
AppleJack Help Forum: <https://sourceforge.net/forum/forum.php?forum_id=271611>
Project Discussion: <https://sourceforge.net/forum/forum.php?forum_id=271610>
Bug Reporting: <https://sourceforge.net/tracker/?group_id=79562&atid=557034>
Support Requests: <https://sourceforge.net/tracker/?group_id=79562&atid=557035>
Feature Requests: <https://sourceforge.net/tracker/?group_id=79562&atid=557037>


CREDITS
I would like to extend a special thanks to Josh Wisenbaker at ComputerTree Technologies whose expertise in Mac OS X allowed him to show me how to make diskutil work in Single User Mode under OS 10.3.x. I would also like to thank Don Montalvo for helping me test version 1.3 of the script.


DONATIONS
If you would like to contribute to further AppleJack development, please visit <http://theapotek.com/teknotes/donate.php?i=AppleJack>, or <http://applejack.sourceforge.net>. Any amount is greatly appreciated. Also, I do gratefully receive suggestions for improving the AppleJack script.

Changes: VERSION HISTORY Recent Changes #1.3 - Added workaround for diskutil in Panther systems - Added a utility for validating .plist files. Corrupted files are now moved to /Library/Preferences (Corrupt). Expanded this facility to include an option in interactive mode to check individual user's preferences. - Added a very primitive form of logging, so you can have a record of what AppleJack did. It is located at /private/var/log/AppleJack.log - changed the user level cache file deletion routine to be more like the preference validator, allowing AppleJack user to choose a specific account to target for cleanup. - Added security checks so that (for example) disk repair will not run if there is write access to the root volume. - Added security check for single user mode. A warning is now posted. - Made certain routines specific to Jaguar or Panther. - A bazillion other little code improvements. #1.2.2.1 -Cosmetic fix for OS version check -Edits on man page. #1.2.2 -Forced script to skip permissions repair on Panther systems. #1.2.1 -Added another system cache file to the deletion routine -/System/Library/Extensions.mkext -Added man file documentation for AppleJack -Added warning message to installer, if attempt is made to run if from outside the distribution folder. #1.2.0.1 -Minor fix to the installer -Also removes /System/Library/Extensions.mkext (how could I have overlooked that one?) #1.2 -Added a basic installer (finally). -Fixed issue where swap files and cache files weren't being dealt with if resident on file systems other than the root filesystem. (If someone has a better way of reading the value of $swapdir in /etc/rc, please let me know. -Better syntax in cache deletion routine. -More complete deletion of cache files. Now also removing: -/private/var/db/volinfo.database -/private/var/db/NetworkInterfaces.xml -/private/var/db/BootCache.playlist -/Library/Caches/com.apple.LaunchServices.LocalCache.csstore -/System/Library/Extensions.kextcache -The search for more cache files routine is now more inclusive (and more dangerous!). -simplified menu. -tried to make usage more explicit and straightforward. -Added exit proofing--forcing a user to reboot rather than exit to multi-user startup, if certain dangerous actions are performed. #1.1 -Enabled file system checking on journaled file systems, through using the '-f' option with fsck, but only for journaled volumes. -Old version of the script rebooted at the end of an automated run; the new version of the script just exits. -Added command line option for running in automated mode with a reboot: If you invoke the script with 'applejack auto', script will run in auto mode, and exit at end. If, however, you invoke the script by typing 'applejack auto reboot', the script runs and reboots when finished. -Fixed a bug where the script would exit if a user typed a key that was not an option in the menu. -Minor code clean up. #1.0 -Fixed an issue where disk repair incorrectly assumed success -Changed some of the letter codes for increased readability -Improvements in user output #0.9 -Original beta release.