I had a lot of trouble figuring out how to do this so I figured it would be a good thing to post.
First of all, what is this called?

Is it the toolbar? The menubar? Trying finding the answer to something on google without being to identify one of the key terms can be taxing. Anyhow, whatever it is called (I’m going with menubar), it is controlled by the SystemUIServer process, that much I know. And what is shown up there depends on settings in multiple preference panes and applications. When it comes to preferences that you set in System Preferences.app, this information is stored in com.apple.systemuiserver.plist. You can see what is in that plist by typing defaults read com.apple.systemuiserver in Terminal.
Check the man page for defaults before you do any writing and be sure you understand what you are doing. (It probably wouldn’t hurt to make a backup of the plist as well (you whimp))
Using defaults write, we can set which items will appear in the menubar by editing com.apple.systemuiserver.plist. This could come in handy in any situation where you wanted to change between two different layouts of those items (using a script for example).
This command will wipe out your current defaults, and create an empty menubar.
defaults write com.apple.systemuiserver '{"menuExtras" = ();}'
This command will set the defaults so that only the clock and volume items show up in the menubar:
defaults write com.apple.systemuiserver '{"menuExtras" = ("/System/Library/CoreServices/Menu Extras/Clock.menu", "/System/Library/CoreServices/Menu Extras/Volume.menu");}'
Since you are only “writing” defaults with the above commands, you will need to re-launch the SystemUIServer process in order to see the change. Do this by typing killall SystemUIServer in Terminal.
I hope that you found this when you needed it without too much googling!
I will eventually be creating a series of posts outlining how to create a OS X client based lab-environment. This series will feature outlines on making a consistent user experience, locking down the workstations, generating use logs, and forcing a Novell server login. I have recently been working on the latter, and wanted to share a few tidbits that have many uses beyond the scope decribed above.
Determining the IP address or hostname of an OS X client from the shell
This comes in handy for logging purposes. Lets say you have multiple machines that you want to keep track of in a single log. Hostname an/or IP are a great way to do this. To get a machines IP address(es) try this from the command line:
ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d -f2
To get the hostname (the piped sed command will remove the .local” suffix) try this from the command line:
hostname | sed 's/.local//'
Mounting an AFP volume from the shell
First you will need to make a folder to use as a mount point. I suggest using the standard location /Volumes/. Let’s say the remote volume is called “Backup”. To make the local mountpoint:
mkdir /Volumes/Backup
Now you will need to mount the remote volume to the local mount point. Let’s assume we want to include the username and password in the command so there is no further user interaction with the GUI. Lets also use an IP address of 192.168.0.1 to identify our remote server.
mount -t afp afp://username:password@192.168.0.1 /Backup /Volumes/Backup
Of course there are ways to make a secure mount without a password too. See my posting on creating and using ssh keys for more info.
Disabling the Dock and the Finder
This involves messing with the core of OS X, so I suggest you stay away from this unless you are comfortable with something like that.
First of all, OS X likes to keep the Dock and the Finder open at all times. Go ahead and killall Dock and you will see that the Dock just relaunches. However, if the Dock is not in the default location or has a different name, OS X won’t be able to relaunch it. Same goes for the Finder. So if you move those applications from wherever they are (wink wink) into the /Applications folder for example, when your computer starts up you will be running OS X sans Finder and Dock.
Now if you made your computer auto-login to an account that had only a Firefox.app startup item, you will have essentially made an internet kiosk. As you can imagine, the possibilities extend way beyond that. You could always open the Finder or the Dock by calling open /Applications/Finder.app or open /Applications/Dock.app using the shell.
Stay tuned to see how these items can be used in the lab environment!
HP’s scanning software is horrendous in OS X. They package scanner drivers for each scanner with some iteration of their HP Scan Pro software. Why they don’t just have one version of HP Scan Pro, and drivers for each scanner to download is beyond me. Want to get software for three scanners? Download three 100 MB packages each containing different versions of the same program! Then, when you install, you don’t even get to pick a destination. Apparently HP knows where I want my applications. On top of that, HP uses generic filenames for preference files. So when you install a second scanner package, it will not only want to overwrite the scanning software designed to work with scanner #1 (located in the again generically named “Hewlett Packard” folder), but also scanner #1’s preference files.
What if I have one scanner at work and one at home? Or in my case, I want to make a system image for a lab that has a few different scanners and I don’t want to have to keep track of which scanner is plugged into which computer and what HP scanner package needs to be installed. Here is how I solved this using Applescript.
- I installed the software for scanner #1 (hp 3970) and verified everything worked.
- I created a folder called HPPrefs in /Library
- I looked in ~/Library/Preferences to see which files were added by the installer, and moved them into a folder called hp3970 within the HPPrefs folder.
- I renamed the Hewlett Packard folder to HP3970 in /Applications so it would not be overwritten when I ran the second scanner install.
- I then repeated this process for the other two software packages.
Now I have three folders in /Applications called HP3970, HP4570c, and HP4370.

I also have a folder (/Library/HPPrefs) that contains three folders hp3970, hp4570c, and hp4370. These folders contain the proper preference files from each of the installs. At this point, all I need is a script that will do the following:
- Delete any current HP scanning preference files in ~/Library/Preferences
- Prompt the user to define the currently installed scanner
- Copy the proper preferences based on the user input from /Library/HPPrefs into ~/Library/Preferences
- Launch the proper version of scan pro
The code:
-- Set variables to the the name of the HD and the current user
tell application "Finder"
set HDName to name of startup disk
set myname to do shell script "whoami"
end tell
-- 1.) Delete any current HP scanning preference files in ~/Library/Preferences
do shell script "rm -Rf /Users/" & myname & "/Library/Preferences/HP*"
do shell script "rm -Rf /Users/" & myname & "/Library/Preferences/com.hp*"
-- 2.) Prompt the user to define the currently installed scanner
display dialog "Which scanner model is attached to this computer?" buttons {"hp3970", "hp4570c", "hp4370"}
set model to button returned of result
-- 3.) Copy the proper preferences based on the user input from /Library/HPPrefs into ~/Library/Preferences
tell application "Finder" to duplicate items in folder (HDName & ":Library:HPPrefs:" & model) to folder (HDName & ":Users:student:Library:Preferences") replacing yes
-- Delay 3 secs for the file copy
delay 3
-- 4.) Launch the proper version of scan pro
if model = "hp3970" then
tell application "Finder"
open HDName & ":Applications:HP3970:HP Scan Pro.app"
end tell
else if model = "hp4570c" then
tell application "Finder"
open HDName & ":Applications:HP4570c:HP Scan Pro.app"
end tell
else if model = "hp4370" then
tell application "Finder"
open HDName & ":Applications:HP4370:HP Scan Pro.app"
end tell
end if
I saved the script as an application (No startup screen, run only) gave it an applicable icon and tossed it in the dock. Now the user just clicks the app, picks the scanner, and scans away!

I made a note about these commands a while back while trying to find a solution to setting the default printer via ARD. They might come in handy some day…
lpstat -pwill show you the printers availablelpstat -dwill show you the current default printerlpoptions -d printernamewill set the default to whichever printer you specify
I am currently installing 10.2 on some old Blueberry iMacs. I came accross an error that said something to the effect of “The destination is not within the first 8 GB of the hard disk”. Ok then. After some searching, I find that the solution is to partition the drive, and install the OS on the first partition, which you have partitioned to a size smalled than 8 GB. Apparently, this monster 20 GB aftermarket drive is too much for 10.2 to handle as the OS drive. Now I realize I have seen this error before, many years ago.
After partitioning and installing the OS, I boot the machine and see the two hard drives. Personally, I have no problem with this. I often have 5 or more drives mounted on my desktop. But where this computer is going, this will be an issue for the user. Now I start looking for a solution to hide this second volume. I came accross this solution. But it requires that I install developer tools. I am not going to try and do that on a G3. So I just tried something simple, formatting the volume with a leading period. A leading period will hide a file in UNIX, OS X is built upon UNIX, why not. It works! So if you ever want to make a volume disappear in the finder (VM drive, backup drive, “don’t confuse the old people with two hard drive icons” drive), format with a leading period. You can of course still access the drive via command line.

.Awesome
When it comes to file manipulation in OS X, I find myself using these three commands often, and usually in combination. Almost every time I use them however, I have to reread the man pages, and review regular expressions. I end up googling the same things and ending up at the same pages, so I wanted to make a single post that will contain all the information and links necessary. Here we go…
GREP
“grep searches the named input FILEs (or standard input if no files are named, or the file name – is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.”
AWK
“Awk scans each input file for lines that match any of a set of patterns specified literally in prog or in one or more files specified as -f progfile. With each pattern there can be an associated action that will be performed when a line of a file matches the pattern. Each line is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern.”
SED
“The sed utility is a stream editor that reads one or more text files, makes editing changes according to a script of editing commands, and writes the results to standard output.”
REGULAR EXPRESSIONS
Regular expressions allow you to use variables in your commands. Most of us are at least familiar with *, where *.db means “every file ending in .db”. There are however many useful regular expressions, and they are the key to executing the above commands efficiently. Brush up on regular expressions here.
PIPES AND REDIRECTS
In order to send the results from one command to another command you need to “pipe” them together. An example:
cat *.txt | grep "blatti.net"
cat *.txt will display the contents of every file that ends in “.txt” to the standard output. By piping those results, they become the input for the second command. grep "blatti.net" will take the standard input, and display each line that contains “blatti.net” on the standard output. So when these two commands are piped together, we will get every line that contains “blatti.net” in every file that ends in “.txt” in the working directory.
While most of your work can be done with standard input and output, you’ll probably want to write your results to a file. Enter redirection. Using the example above, lets say we wanted to take our results and write it to a file. This is done with the > redirector.
cat *.txt | grep "blatti.net" > results.txt
This command will take every line that contains “blatti.net” in every file that ends in “.txt” in the working director, and write them to the file “results.txt”. Note that this will overwrite any existing “results.txt” file that exists in the working directory. Which begs the question “What if I want to append instead of overwrite?” Well then use >> instead of >. The >> redirector is especially useful if you are creating logs.
Now you too can create obnoxious commands with limited knowledge! The command below is one I created using the resources listed in this article. It is part of a piece of software that pulls text out of a PDF and returns a specified section in a text file. (I’m sure it is inefficient – so someone chime in and tell me how to make it better so I’ll know for next time)
sed 's/^[0-9]$/Period &/' /tmp/skypdf.txt | sed 's/[A-Z]*$/&,/' | sed '/Period/G' | sed '$!N;s/\\n/ /' | sed '/Period/{x;p;x;}' | sed 's/^ //' > ~/Desktop/full.txt"
Now say that 10 times fast!
Now that I have comitted myself to OSX, I had to start using iSync to sync my Treo with my Address Book and iCal. For some reason this is still a goofy process.
- You open iSync
- You tell iSync to begin the sync process
- iSync asks you to start initiate a sync with the Palm software
- Conduit Manager syncs some things with iApps (iCal, Address Book) and others with Palm Desktop (Pictures, Phone call DB)
- Conduit manager completes the sync and quits itself
- You manually quit iSync
Again, there has to be a better way to do all of this. Unfortunately I have heither the ambition or know how to fix the entire problem, so I’ll tackle what I can fix. Everytime I open iSync, I want to sync my device. Everytime the sync is complete, I want to quit iSync. Enter iSyncandiQuit. Simply run this application and it will launch iSync, initiate a sync, and upon completion of the sync, quit iSync and itself.

Benchwarmer is a simple backup application designed for basic users. It allows the user to backup some critical elements of their home directory including:
- Mail (including prefs)
- Address Book (including prefs)
- iCal (including prefs)
- Desktop
- Documents
This data is backed up into a single ZIP archive on their desktop. Please leave any questions, comments, or requests as comments on this post. Thanks.
Download Benchwarmer HERE.
Well after suffering for a long time with my quality eMac, my employer sprung for a new MBPro for me. Everything seems fine so far, allthough I have noticed some display issues. Now that I have a processor that can handle it, I have been using a bunch of new applications. I’ll try to get some reviews and links up in the coming days. Now check out this quality pic! (The camera I used was so old it stored the files on a floppy)








