Log in

Posts Tagged ‘OS X’

Oct
26

Snow Leopard’s System Preferences loves to complain when you try to open older 32-Bit preference panes and will require you to restart in 32-bit mode to open them. One of the annoyances of running the MySQL on Snow Leopard is that even though they have an x86_64 package they still ship a 32-bit preference pane with it. The guys at Swoon got sick of this and have put out a 64-bit preference pane. Not an every-day annoyance but a small one that’s been fixed. Hopefully it’ll be rolled into the package released on mysql.com soon.

Jul
30

A while back i decided to setup a 3-drive ZFS pool in the MacPro. The only complaint so far is that OS X gets a little eager with putting the drives to sleep for my taste. In more recent versions of OS X the only option for putting the drives to sleep is a checkbox that, when on, will attempt to put the drives to sleep after 10 minutes of inactivity.

In the early days of OS X the Energy Saver preferences looked a little different – users could set a time to wait before putting drives to sleep.

OS X 10.1 Energy Saver Preference Pane

Thankfully after some digging i realized it could all be set through the pmset command. The man page has everything you need but for the lazy here’s the gist for disk sleep timing. pmset takes a flag to determine which power profile you’re changing: wall-charger (-a), battery (-b), UPS (-u) or all profiles (-a). Next simply pass it the disksleep argument and a number in minutes.

Set all power profiles to sleep the disks after 15 minutes instead of the typical 10:

sudo pmset -a disksleep 15

Setting the time to 0 will disable disk sleep altogether for that power profile.

One interesting thing to note is i originally stumbled onto this on a rather old article that suggested using the spindown argument instead of disksleep as the man page now suggests (as of 10.4). Using spindown does not cause pmset to complain though it appears to disable disk sleep altogether.

Dec
30

This is a simple little trick that i’m not sure where i first read about.

If you’re in the terminal and need to copy something to the clipboard (say the output of a command) you can pipe it to the pbcopy command. Likewise the pbpaste command will spit out the last thing copied. Likely not the most useful thing you’ll find all day, but still interesting to know.

One small caveat however is that the pbcopy command will copy newlines at the end of your output so often the copied text isn’t as immediately useful for re-inserting into another command as one would hope.

Oct
23

Wanting to have easy access to all the documentation for my installed gems i decided to setup a startup item for the gem server that comes with RubyGems.

Come to find out the process is incredibly simple. First create a shell script to star the server:

#!/bin/sh
/usr/bin/gem server --daemon

Then create a plist file describing the startup item:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
    <dict>
        <key>Description</key>
        <string>Ruby Gems Server</string>
        <key>OrderPreference</key>
        <string>Late</string>
        <key>Provides</key>
        <array>
                <string>RDoc Server</string>
        </array>
    </dict>
</plist>

Create a folder, i named mine GemServer, and name the shell script the same. Put the script and the plist into this directory and copy it to /Library/StartupItems (you may have to create this).

Or, you could just download the startup item and extract it to /Library/StartupItems.

Restart and point your browser to localhost:8808 and peruse your documentation ’til your heart’s content.

Sep
13

iTunes Genres

iTunes 8 has a new feature i’d been wanting for a while – grid view. Giving you the ability to view your music in a simple grid, much like iPhoto, grouped by album, artist, or genre. Normally you’ll see album artwork in this view; switching to genre view, however, shows some campy artwork for certain popular genres (pop, rock, hip-hop, etc) but is missing artwork for more specific / niche genres. A post on the iLounge forum details how to create custom genre artwork but it’s a little more verbose than need be and geared at the Windows audience. So here’s the briefer version for OS X.

  1. Close iTunes if it is running.
  2. Open your Applications folder (⌘⇧A).
  3. Control- / Right- Click on the iTunes icon.
  4. Select “Show Package Contents” – this will open a new Finder window.
    Show Package Contents
  5. Open the “Contents” directory. Here you will find JPG images that begin with “genre-”, these are the files iTunes uses for its genre artwork. Those ending in ‘M’ are for movies.
  6. Copy one of these files to your Desktop by dragging it and holding Option (⌥).
  7. Edit this file to your liking and rename it to the genre of your choice, for example “genre-metal.jpg” for metal.
  8. Move it back into the Contents folder.
  9. Now open “genres.plist” in your favourite text editor (TextEdit will work).
  10. Copy one of the <dict> entries and paste it into the list (making sure to do this between other entries, that is after a closing tag: </dict>).
    <dict>
         <key>matchString</key><string>rock</string>
         <key>resourceFile</key><string>genre-rock.jpg</string>
    </dict>
  11. Now edit the entry you just pasted to match the genre you are replacing. The matchString (in this case “rock”) becomes the word or phrase you want itunes to search for1 and the resourceFile (in this case “genre-rock.jpg”) becomes the name of the image you just copied into the Contents directory.
  12. Save the file and launch iTunes. You should see your new genre art in the grid view now.

1: The matchString appears to match around special characters. For instance the entry for R&B is “r b” but still matches the string “R&B” in iTunes. Also note that this string does not need to be a perfect match. A matchString of “metal” would also match the string “Epic Metal” or “Power Metal”.