Monthly Archives: November 2007

Quick Look shortcut: Space Bar

It couldn’t be more simple (a bit too simple).  Want to quick look a file, any file? Single click the item or arrow over to it and hit Space Bar.  This toggles up the item for viewing in Quick Look.  Hit Space Bar again to un-quick look it.

Update: April 24, 2013: To open up the file you have open in Quick Look, hit key combination Command + Down Arrow.  This is the normal launch/open hot key combo for opening any file, under Quick Look or not.  The file will still remain open in Quick Look when you do this.

Quick Look toggled window

Focus to Menu Bar Not Working

Here’s a bizarre problem: All of a sudden I couldn’t hit the Ctrl F2 keyboard shortcut to set focus to the menu bar. It wasn’t because the shortcut was disabled through Ctrl F1 (by default the functions for keys F2 to F6 are disabled by default), it was due to some bizarre problem with Quicksilver – keyboard navigation voodoo. For some reason ^ F2 would only work after I had Command Tab’d to Quicksilver, hit Ctrl F2 (which worked, focus was set to the menu bar), afterwards, the shortcut worked as normal with all other open applications.

Bizarre.

Quicksilver is the bomb, btw, in case you didn’t know. Dock? What Dock?

Dual Boot OS X Leopard Tiger (10.5 10.4) Installation

The following is a summary of how I created a dual boot setup of OS X Leopard (10.5) and Tiger (10.4) on a MacBook Pro, keeping the original Tiger installation intact and available through alt/option booting during system startup. Always Always Always make a backup before you try any shenanigans like I do below. The best way to do this is with an external drive connected to your machine via FireWire or USB 2.0 and using cloning software such as SuperDuper!Leopard screenshot

Step One: Boot from Leopard

Boot from the Leopard install dvd to allow repartitioning your Tiger-installed hard disk without erasing the disk first. Insert the Leopard install DVD into the dvd drive. Ignore the pop-up Finder window. Shut down your Apple computer (don’t use restart). After your Apple has shut down fully, press the power button to start it.

When you hear the power-on “chime”, press and HOLD the Option button (just left of the Apple/Command key, also known as Alt or two horizontal lines, one diverging before connecting with the other). If for some reason your Mac doesn’t make a noise when you boot up, just press and hold the Option button when the screen lights up. Hold the Option button down until you see a grey screen with two (or more) options displayed. One of which will be a picture of a hard disk and another of the Leopard OS X Install DVD. You may have more bootable disks to choose from if you have more than one partition on your hard disk.Using the arrow keys, move to the Leopard Install DVD and hit Enter. This will boot into the Leopard install program.

DO NOT hit continue when the Leopard install window has loaded.Using the mouse, navigate up to the top menu bar and choose Utilities, then Disk Utility. Once Disk Utility has loaded you should see your Apple computer hard disk, the Leopard install dvd, and possibly other Disk Utilitydisks if you have them attached to your computer.

Choose the hard disk that you want to install Leopard on. By default this should already be selected. For me the Disk is a 111.8 GB Fujitsu MHW2… drive with Macintosh HD underneath it (that’s the volume, within the Macintosh hard disk, you can have multiple volumes inside one hard disk). From here you should see the partition map of your Macintosh HD hard disk, a rectangle standing tall, outlined in blue.

Above the right hand side window will be five choice buttons: First Aid, Erase, Partition, RAID, Restore.

First Aid:You will want to Repair your Macintosh HD before doing any partition changes, regardless of whether you know it is verified or not already. Paritioning will fail if the disk is not error free and verified within this install session. Verifying the disk within Tiger does not mean that Leopard Disk Utility will consider the drive error free as was the case with my install. Thus, repair the disk once you get to this step, even if you had previously verified the disk in Tiger.

Step 2: Resizing + Creating Partitions

After Verify Disk step is completed, we’ll resize the current Macintosh HD Tiger partition and create a second Leopard partition with the free space. NOTE: The resize and creation of a secondary partition will LIKELY FAIL if you have Parallels installed in your Tiger system disk/volume. For the repartitioning to complete without “no space left on device” error, I was forced to delete my Parallels Windows XP SP2 virtual disk, which was roughly 10GB in size.

There are some files that Disk Utility Partition program cannot move when performing its resize and repartiton operation. The Parallels virtual disk file is one of these immovable files. When Disk Utility comes across this file, repartitioning failed with the error: “no space left on device”. The solution in my case was to reboot back into Tiger, load up Parallels, and simply delete the virtual Windows XP installation (I skipped deleting the floppy drive) which deletes the virtual disks as well. I chose this because my Windows XP install is already backed up onto an external USB 2 drive clone of my Tiger system created through SuperDuper!. I’m guessing that you can simply move this file off to some secondary external drive, replace it after, and everything will be handy dandy, although I have not tested this.

EDIT: Yozlet mentions in the comments below that removing large files (1GB+) can also help avoid the dreaded “no space left on device” error while repartitioning the drive. Here are some tips on finding and removing old files on your Mac to avoid the “no space left on device” error.

Dual Boot Leopard and Tiger Partitions

Click and drag the bottom right hand corner of the Volume Scheme (the blue outlined rectangle which represents your disk, Macintosh HD) and drag it upwards, making the volume smaller. I chose around 30GB for the Macintosh volume, out of the entire 110GB disk. This leaves a healthy chunk (80GB) of unused disk space on the drive. Beneath the blue rectangle Volume Scheme there are plus and minus buttons. The plus button when clicked will add a partition to your disk. Click this to add a generic volume onto which we will install Leopard. After clicking the plus button for adding a partition, I again had to adjust the size of the Macintosh HD volume where Tiger resides, back down to about 30GB. After this, click Apply, then Partition on the pop-up window. Go make some coffee while it does the partitioning.

After you’re well caffinated partitioning should be finished and you’ve got a pristine empty partition on which to install Leopard.Exit out of Disk Utility and you’ll see the Leopard install screen again. Click Continue from here and you’ll be asked where to install Leopard. Here we choose Leopard on our hard disk. After that, continue with the install as per normal.

Step 3: Transfer

Near the end of the Leopard install the setup program will ask if you already own a Mac and want to transfer previous settings and applications. For this step choose from another volume on this Mac. Obviously the volume we’ll use is the Tiger volume that we’ve preserved on this computer. After that, I choose User files and settings, Applications and network settings. You can choose what you desire here, but I left it at that. Any programs or settings that didn’t make it over should be easy enough to replace, reinstall after. This step can take the better part of an hour depending on how much data you’re transferring.

Best of luck. Keep that backup handy.

Share this:


Try Blockbuster Total Access Free for 2 Weeks

Get OS X Leopard Setup for Ruby on Rails Development

After doing a clean install of Leopard (on a blank partition) and importing user settings / home directory, this is what I needed to do to install the Ruby on Rails development environment on Leopard OS X 10.5.

TextMate

TextMate transferred OK as an application during the import phase after the install of Leopard. The only thing needed was a re-setting-up of the command line launcher for Textmate. A symbolic link to TextMate’s mate program in Applications placed within the /usr/bin directory does the trick:

sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /usr/bin/mate

MySQL 5

  • Download OS X 10.4 pre-compiled mysql binary from MySQL.com (use FTP link if you can, for some reason Firefox recognized .dmg as text mime type for the HTTP link).
  • Double click the .dmg file to mount the disk image.
  • Run the mysql-5.0.45-osx10.4-i686.pkg installer.
  • Run the MySQLStartupItem.pkg to have MySQL start upon system boot.
  • Add the location of the mysql executable to your path. For me this involved adding a line to my .profile file in my home directory
    export PATH=${PATH}:/usr/local/mysql/bin
  • Then start the mysql daemon
    sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
  • At this point there should be a socket file created in your /tmp directory for connecting to mysql. Check that the following file exists: /tmp/mysql.sock
  • Login to mysql and change the root password:
    mysql -h localhost -u root
  • mysql> USE mysql;
  • mysql> UPDATE user SET Password=PASSWORD('root-pwd') WHERE user='root';
  • mysql> FLUSH PRIVILEGES;
  • mysql> EXIT
  • Create any other mysql accounts you need:
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'prod'@'localhost' 
    IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

    (do not include the backslash ” in this command, which was used to denote a wrapped line)

  • At this point you might want to clear out your mysql command cache (which contains what password you just set for root) located in your home directory.
    echo -n > ~/.mysql_history
  • Now load your data back into MySQL. For me this consisted of exporting the database from the production site
    mysqldump -u <username> -p -q --single-transaction 
    <db_name> > <backup_filename>

    then create the database within mysql before importing to that database

    mysql>create database my_kickin_database

    From the terminal:

    mysql -u <username> -p my_kicking_database < <backup_filename>

ImageMagick RMagick

Despite all the badpress RMagick gets about using scads of RAM and that ImageScience is a better solution, RMagick is still quite useful. The RAM stuff is also not an issue if you can figure out how to do your image manipulation calls via command line. Plus it’s got a lot more features than FreeImage/ImageScience and in my experience, more stable as well.
Solomon White’s got a great shell script for installing ImageMagick and RMagick from source without MacPorts and that’s the route that I’ve chosen to go. Check the instructions at his page. Thanks Solomon.

Be sure to install Mac OS X XcodeTools from the Leopard install DVD (Optional Installs/Xcode Tools/XcodeTools.mpkg) before attempting this source install of ImageMagick/RMagick; The compilers necessary to build these packages are not installed on OS X by default. In particular what you need are Developer Tools Essentials and UNIX Development Support. All other stuff in the Xcode Tools package are not essential for this install. Install those two packages. Should take about five minutes or so.

You may want to run each of the steps listed in Solomon’s script one at a time in case one of the them fails. You wouldn’t want to finish building ImageMagick from source (not exactly quick) when you find out that your download of the jpeg source libraries failed and ImageMagick got built without JPEG support. (This is a current issue with the jpeg source download source that Solomon’s script is using for the download, so caveat emptor).

UPDATE: The RMagick gem install may fail with an error of “too many examples failed” if the compilation and install of the jpeg package did not install static nor shared libraries (default behaviour). What this means is that the JPEG package is installed binary executable files, but not libraries that other programs such as ImageMagick can use to manipulate photos and image files. This is easy to correct. To make sure that the JPEG package installs the actual JPEG libraries do the following within the jpeg-6b directory (which was created when you untar’d the jpeg6b.tar.gz source file):

  cp /usr/share/libtool/config.sub .
  cp /usr/share/libtool/config.guess .
  ./configure --enable-shared --enable-static
  make
  sudo make install

Thanks to Matt King for posting instructions on fixing the JPEG library ImageMagick / RMagick errors.

That should be all that’s required to install the actual JPEG libraries. Now return to the ImageMagick directory (also created when you untar’d the ImageMagick source files) and try configuring and building again (NOTE: the “configure” line is just one line, no carriage returns in between all those –with –without command line arguments):

./configure --prefix=/usr/local --disable-static --with-modules
--without-perl
--without-magick-plus-plus --with-quantum-depth=8
 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install

Ruby-debug

This is the god of command line debugging for Rails. Grab it and gem install that baby. Once you get used to it, you’ll love it.

Resolution Phase

Once you’ve got these guys installed you should check whether you need any other gems specific to your Rails project. The gems you can skip since Mac OS X Leopard’s Ruby install includes them already: Capistrano 2.0 (and requirements), RedCloth 3.04, mongrel 1.01, hpricot .6, fastthread 1.0 and perhaps others that I’m forgetting about.

At this point, wander over to your Rails project directory and fire it up (using ruby-debug of course): rdebug -n script/server and check that everything is peachy. If things blow up, don’t panic. Things to check:

  • If you were previously using MacPorts for your MySQL install, you’ll likely have a different sockets file location now. By default MacPorts slapped the socket file somewhere like: /opt/local/var/run/mysql5/mysqld.sock Although now you’re playing with a socket file in /tmp/mysql.sock. Head over to your config/database.yml file in your Rails project and make sure your development environment is pointing at the right socket file and that the socket file is actually there.
  • Read over the webrick log that’s upchucked an error. Good chance that at the top of that error you’ll see a call to some missing gem that you’ve forgotten to load up. Head on over to RubyForge and rectify your situation.

Share this: