How to Test RAM Under Mac OS X

January 12, 2008

Whenever I get a new stick of RAM for my Mac or PC, I’m always eager to just plug it in and start using it to its fullest, but having worked on hundreds of computers and encountering dozens of bad memory modules has convinced me that thorough testing is a must. While off-the-shelf PCs can run a copy of the free Ultimate Boot CD tool to perform RAM tests, Macs are a little bit more complicated in this respect. If you’ve purchased AppleCare for your Mac, it comes with a bootable TechTool Deluxe disc, but you’re otherwise left to your own devices when it comes to hardware tests.

Fortunately, with a little preparation right now, you can boot your Mac into Single User Mode and do a complete RAM test in the future. While you can run the necessary software in a fully-booted system, I recommend doing testing in Single User Mode where there are far less programs loaded in memory, and less chance of an important system component getting corrupted if your machine freezes or kernel panics – common symptoms of bad memory. A modified Mac OS X boot CD would be ideal, but that’s another post for another day!

Download Memtest

The testing setup isn’t terribly complex; I’ve taken the liberty of putting together an installable package which will put the Memtest utility into your /usr/bin/ folder. Memtest is a Unix command-line program that does the memory testing, and is the Mac equivalent of MemTest86.

Memtest Usage

To run memtest on a new memory module, first shut down your computer and install the new chip. (Some helpful guides for doing this can be found at iFixit, if you’re unsure of the exact steps.) Ensure the chip is firmly in place, close up your machine (or don’t, if you’re a pessimist), and power it on while holding down the Command and S keys to force Mac OS X to boot into Single User Mode. Once you see a black screen with white text, you can release the key combination. After all the system logging is done scrolling past, type memtest all 2 to test all memory two times. Two passes should be enough to detect any blatant problems, but I wouldn’t hesitate to let it run for hours on end if I suspected an intermittent memory problem (memtest all). When complete, you should be greeted with “All tests passed” if your new RAM is in good condition. If your system locks up or freezes indefinitely during the test, you may have a bad memory module on your hands.

Feb. 16 2012 Update: Memtest is still working under Mac OS X 10.7 Lion.

Oct. 25 2012 Update: Memtest is still working under OS X 10.8 Mountain Lion.

GrabFS for Leopard

January 3, 2008

Mac OS X Internals author Amit Singh has put together a unique plugin for MacFUSE called GrabFS, which is a virtual file system of running applications, in which you can navigate through windows and view current screenshots. That’s a lot going on in one sentence, so lets take it bit-by-bit:

MacFUSE is a Google project headed by Amit to port the FUSE tool from Linux to Mac. Effectively, it mounts what appears to be a disk image, but the contents of the image can be from any source. The key to FUSE is that the apparent files and folders can be conjured up based on information obtained elsewhere, be it from other files and folders, a remote server, Flickr image streams, or process lists. Plugins allow authors to devise new ways of presenting a hierarchy to the end user, regardless of the original data format.

In the case of GrabFS, it lists each running application on your Mac as a folder inside the virtual FUSE disk. Inside every folder is a screenshot TIFF file for each window of that application, which you can view in place or copy out for later use.

MacFUSE isn’t a new project, but talented developers are continually thinking up new sources of information to plug right into your desktop.

PHP5 and MySQL 5 on Leopard

December 7, 2007

A few quick notes about building MySQL 5.x and getting it working under Leopard:

  • Follow Dan Benjamin’s excellent MySQL on Leopard tutorial.
  • Copy the PHP configuration example to the actual expected location: sudo cp /etc/php.ini.default /etc/php.ini
  • Edit it, and add /private/tmp/mysql.sock to both mysql.default_socket and mysqli.default_socket.
  • Save, and restart Apache: sudo apachectl graceful

Once completed, the default PHP5 setup that comes with Mac OS X 10.5.x will be able to communicate with the MySQL version built using the above linked tutorial. Time to get developing!

How to Import and Export ICNS with Photoshop

November 27, 2007

If you’re interested in making replacement icons for Mac OS X applications, the Leopard Developer Tools received an updated version of the Icon Composer utility, which combines multiple PNG images into one ICNS file. Once exported, the combined file is suitable for use inside an application bundle, by choosing Show Package Contents from the Finder’s action menu (or a right-click) and browsing to Contents/Resources/ and replacing the appropriate ICNS file (make sure to rename your icon to match the existing one!).

To run the process the other way, first find the desired ICNS file inside the application, and open it with the built-in Preview application. Preview understands the transparency inherent to ICNS icons, and allows you to save the file as a PNG, ready to open and work on in Photoshop!

Update: After looking around on MacUpdate for something simple, I found img2icns, a freeware drag-and-drop icon converter that can turn a PNG image into a folder icon. With it, you can Get Info for the converted folder icon and copy and paste it onto another application or document. It’s the perfect little icon utility to go with this minimalist workflow, and it’s Leopard-ready!

Halo 3's Fixed IP Problem

November 19, 2007

Ever since opening Halo 3 and hopping on Xbox Live with it, it’s been complaining about my router’s NAT settings. Apparently, it needs certain ports open to connect to other gamers. Tonight, I finally set out to get it working properly, but came up short.

After first doing a little research and discovering that Xbox Live uses TCP and UDP port 3074 and UDP port 88 (largely UDP port 3047, as indicated by my Ethereal packet dumps), I thought I could get away with forwarding those ports straight to my Xbox 360. Since my console was set to automatically lease an IP address from my router, it would quite probably get a different IP each time it boots up, thus “breaking” my carefully forwarded ports. The obvious solution is to choose a fixed IP address in the Xbox Dashboard. Once the IP is set statically and the appropriate ports are forwarded, all seems to be well, except for one minor hangup…

If you boot directly to the Halo 3 disc with with a fixed IP address, the network connection never links up before executing the game. Halo 3 runs, then refuses to connect to Xbox Live. I have to exit the game, go back to the Xbox Dashboard, Sign In to Xbox Live, then re-launch Halo to get it to go online. It couldn’t be a more roundabout way, but it seems that’s the only answer aside from enabling uPNP on the router, which I’ll never do for security reasons. I doubt my DD-WRT powered WRT54GL router is “Microsoft Certified,” but the problem seems to lie with the Xbox 360 or Halo 3, as it won’t even acknowledge the presence of an Ethernet cable until the Xbox Dashboard launches. Weird.

Update:Here’s one solution: Open the DD-WRT settings, go to Administration, Services, then the DHCP Server grouping and set a static lease for the Xbox 360’s MAC address. Set the Xbox 360 back to Automatic IP address leasing, and the router will assign a fixed IP based on the console’s MAC, ensuring it’s the same every time, without the Xbox having to be set to static.

Mastodon