Category Archives: Mac

Articles related to the Apple Mac, OS X, etc.

Resetting the iPhone

I had a bit of a worry this morning, as my iPhone suddenly shut down and was unresponsive, as if the battery were completely dead.

I was able to force a reset using the instructions on the Apple web site Frozen or Unresponsive iPhone.

The gist is to hold down both the power button and the home button until the Apple logo appears and disappears. This can take 15–20 seconds or so.

 

OS X, Apache, Tomcat, and mod_jk

I spent some time with a colleague from South Africa yesterday. He’s a long-time Windows user that writes in Java. He has a new MacBook Pro, and we scratched our head why Apache+mod_jk+Tomcat was blowing up on him.

JAVA_HOME

The first thing we had to get right was the JAVA_HOME variable. If it’s not set right when compiling mod_jk, you’re out of luck. On OS X there is a program that spits out the right value. We put the following in his ~/.profile. Please note the back ticks (accents graves) to run the java_home program.

export JAVA_HOME=`/usr/libexec/java_home`

mod_jk

With $JAVA_HOME set correctly, compiling mod_jk was straightforward. Download the mod_mod_jk tarball, unpack it, and change directories to the native subdirectory. The following should work cleanly.

$ ./configure --with-apxs=/usr/sbin/apxs
$ make clean ; make
$ sudo make install

Apache Configuration File

Be aware that OS X Lion has some lines (commented out) for support for mod_jk. Be sure to uncomment those lines. Previous versions of OS X don’t have these lines, so you’ll just add the load module directive and Jk* commands in the usual places.

That’s it, really. Once JAVA_HOME and the Apache configuration file were straightened out, things worked.

How to Reveal Hidden Files and Folders in a Mac OS X File Dialog

I downloaded a development tool to give it a trial run today. It reported that git support was disabled because it wasn’t on the path. I thought this odd since it works in Terminal. It turns out that the UI uses a different PATH than Terminal. That’s a topic for a different article.

The path to git is /usr/local/git/bin/git, but this cannot be selected in a file open dialog since /usr (along with other system directories) is hidden. 99.9% of the time this is no problem. Anybody who needs to dig into those directories will drop to the command line instinctively. However, this tool offered no place to type in a path. Only the file open dialog was available.

It turns out that there is an undocumented (or poorly documented) key combination to show and hide hidden folders and files. Press Command-Shift-Period (⌘⇧.) to toggle hidden files and folders on and off.

OS X Preview’s Hidden Powers

I use Preview’s ability to manage pages in PDF files after scanning pages into the computer (points number two and three). Ofttimes the back side of the page gets scanned in (I frequently use green engineering paper twenty years after college) and I want to remove those from the PDF. I also will merge pages from PDF. Drag. Drop. Save. Done.

I ran across a Macworld article called Preview’s Hidden Powers that lists of the capabilities of the built-in Preview tool in OS X. It lists a couple of other uses that you might find useful.

 

Making a Mac Tab to Drop-Down List Controls

Developers, and power users in general, tend to like using the keyboard for moving around because it’s ofttimes faster to push a key or two than pick up the dominant hand, grab the mouse, click, then move the hand back to the keyboard.

The default behaviour on OS X is to skip drop-down (“list box”) controls when using the tab key to move around, which is at odds with using the keyboard for navigation. But, this can be changed in System Preferences.

Screen shot showing where in the keyboard preferences to make the change.

Reset Passwords on Tiger without an Install Disk

I was asked to reset the passwords on an old Mac. This is usually done by booting with an install disk for the right version of the operating system.

Determine OS Version

The OS version was not displayed on the screen. To determine this, I booted to single user mode. (Hold down Apple-S while booting.)

From the command line, type:

# sw_vers

This will show the OS version. For this machine, it was OS X 10.4, or Tiger. I do not have a working install disk for Tiger, so I could not do it the easy way.

Reset Passwords

After booting into single-user mode again, I had to mount the root directory as read/write, then start the base services.

# mount -uw /
# sh /etc/rc

I didn’t t know the short name for the account, but that was easily determined by

# ls /Users

Now I could do a simple

# passwd account
# reboot

Operating the Second DVD Tray on a Mac via the Keyboard

On Macs with two DVD drives, both can be opened and closed from the keyboard.

The primary drive can be opened and closed normally, with the eject key (⏏).

The secondary drive can be opened and closed holding down the Option key, i.e. Option+⏏.

Note:

If your computer cannot display the eject key button symbol correctly (e.g. ), it looks like this: