Posted: August 21st, 2010 | Author: Jerod | Filed under: OS X | Tags: extensions, safari | View Comments
I asked this on Twitter the other day, but alas nobody came back with an answer.
Turns out it’s pretty easy to edit a Safari extension that you’ve downloaded. The downloaded file will have a .safariextz file extension. To extract the contents of the file, use the xar command. I’ll demonstrate with the BetterSource extension.
jerod@mbp:~/Downloads$ xar -xf BetterSource-1.0.safariextz
This will create a new directory called BetterSource-1.0.safariextension which has the plugin’s source files (plists, html, js, css, etc.). You can add this to Safari’s Extension Builder by:
- Selecting Develop -> Extension Builder from Safari’s menu bar
- Clicking the + button in the lower-left corner of the editor window
- Pointing the open dialog box to the BetterSource-1.0.safariextension directory
And that’s all there is to it.
Posted: September 9th, 2009 | Author: Jerod | Filed under: OS X | Comments Off
OS X’s built-in System Profiler provides a great graphical display of pretty much anything you’ll want to know about your Mac.

That’s cool and all, but what if you want to access that information programmatically? Turns out you can also run the System Profiler from the terminal by executing this command:
jerod@mbp:~$ /usr/sbin/system_profiler
What’s great about this access method is that it allows you to slurp that data into any other program and have your way with it! For instance, I wanted to track my new battery’s cycle count and charge capacity over time. Why? I dunno, because I’m a geek, okay, get off my back!… Anyways, with the system_profiler command I simply run this little Ruby script every day:
1
2
3
4
5
6
7
8
9
10
| require 'date'
data = `/usr/sbin/system_profiler SPPowerDataType`
cycles = data[/Cycle count: (\d+)/, 1]
condition = data[/Condition: (\w+)/, 1]
capacity = data[/Full charge capacity \(mAh\): (\d+)/, 1]
File.open('/Users/jerod/Documents/battery_history.csv', "a") do |file|
file.puts "#{Date.today},#{cycles},#{capacity},#{condition}"
end |
Ruby uses the (possibly familiar) backticks (line 3) to capture output from a shell command. All that was left for me to do was to parse the raw data and save it to a CSV file.
Finally, note that the my script is passing SPPowerDataType as an argument which narrows down the returned results. You can learn more about how to use the system_profiler command by readings its manual. Just:
jerod@mbp:~$ man system_profiler
Posted: September 1st, 2009 | Author: Jerod | Filed under: OS X | Tags: hacks, snowleopard | View Comments
Looks like I’m not the only one who hates Snow Leopard’s blue ring around selected windows in Exposé.
Thankfully, we don’t have to live with such monstrosities. Here’s a quick fix to free yourself from the blue haze. Fire up Terminal.app, then:
1
2
3
4
| cd /System/Library/CoreServices/Dock.app/Contents/Resources/
sudo mv expose-window-selection-big.png expose-window-selection-big.ugly
sudo mv expose-window-selection-small.png expose-window-selection-small.ugly
sudo killall Dock |
This will disable the blue rings altogether, but you may want to replace these two images with some custom ones that look a little cooler instead.
Let me know via the comments or on Twitter if you find some replacement images!
***UPDATE***
My friend Doug provided some drop-in replacement images that are a huge improvement. Just drop them into the directory after renaming the default images. So after step #3 above, do:
This will open Finder in the current directory. Now drag the replacement images into this directory, provide your password, and kill the Dock.
VoilĂ !
DOWNLOAD HERE
Posted: June 6th, 2009 | Author: Jerod | Filed under: OS X | Tags: macports, php, readline | Comments Off
OS X ships with PHP5 installed but it does not have readline() support compiled in. Anybody using PHP from the command-line will want this, as it allows handy things such as tab completion and scrolling through command history using the up arrow.
Thankfully, MacPorts has a readline variant that can be easily installed:
sudo port install php5 +readline
If you execute the command above, apache2 will come along for the ride because it’s a default variant for the PHP5 port. If you don’t want apache2 (OS X ships with apache2 anyways), modify the command to look like this:
sudo port install php5 -apache2 +readline
Not sure if your PHP install has readline support? Execute this one-liner to find out:
<? echo function_exists('readline') ? "yes\n" : "no\n"; ?>
Posted: April 21st, 2009 | Author: Jerod | Filed under: OS X | Tags: iusethis | Comments Off
The anointing of an OS X application:
