Doing device level copies with dd is a reasonably common Linux task, but not something OS X users typically do. However, if you find yourself needing to write an image file1 to a microSD card or some other media then here’s a simple guide to using it.
First, you’ll want to see the device labels.
diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *250.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 249.7 GB disk0s2 /dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *2.0 GB disk2 1: DOS_FAT_32 THUMB_DRIVE 2.0 GB disk2s1 |
The output from above shows that we have a mounted 2GB USB flash drive named “THUMB_DRIVE” that has been given the identifier /dev/disk2. To write to it we need to unmount it, but ejecting it in the normal Mac way won’t work here.
diskutil unmountDisk /dev/disk2 |
There we go! Now we just need to write our image file.
dd if=inputfile.img of=/dev/disk2 |
The shell will appear to hang, but you can check disk activity to see that it’s writing. Once the command returns you’re done!
Update: OS X Lion (10.7) users. Mail bundles have changed significantly in Mail 5.0 so the quick fix hack will not work to get GrowlMail functioning again. There will need to be some actual development work to make it compatible. Sorry!
Welcome back! We’ve been here before haven’t we? Check out my previous post on this issue if you want more background on why this occurs.
Download a pre-patched GrowlMail.bundle and drop it in your ~/Library/Mail/Bundles/ directory1. If you want it available to multiple users on your system, use /Library/Mail/Bundles/.
Download GrowlMail 10.6.7 mailbundle
If you use this method you’re all set; no need to use the command line solution below.
If you have already had your plugins disabled by opening Mail.app you’ll need to look in ~/Library/Mail (or /Library/Mail if you installed globally) and move the files back to the active bundles directory. They’ll typically be in Bundles (Disabled) or something similar, so quit Mail, find them, and move them back into the proper directory.
If you have a local installation:
defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "1C58722D-AFBD-464E-81BB-0E05C108BE06" defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "9049EF7D-5873-4F54-A447-51D722009310" |
Global installation:
defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "1C58722D-AFBD-464E-81BB-0E05C108BE06" defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "9049EF7D-5873-4F54-A447-51D722009310" |
Update: Fix for 10.6.7 and Mail 4.5
Another OS X release (beta as of this posting), another broken GrowlMail bundle. I did a post just like this for 10.6.2 (and 10.6.4). Check it out if you want more background on why this occurs.
Download a pre-patched GrowlMail.bundle and drop it in your ~/Library/Mail/Bundles/ directory1. If you want it available to multiple users on your system, use /Library/Mail/Bundles/.
Download GrowlMail 10.6.5 mailbundle
If you use this method you’re all set; no need to use the command line solution below.
If you have already had your plugins disabled by opening Mail.app you’ll need to look in ~/Library/Mail (or /Library/Mail if you installed globally) and move the files back to the active bundles directory. They’ll typically be in Bundles (Disabled), so quit Mail, find them, and move them back into the proper directory.
If you have a local installation:
defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "857A142A-AB81-4D99-BECC-D1B55A86D94E" defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "BDD81F4D-6881-4A8D-94A7-E67410089EEB" |
Global installation:
defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "857A142A-AB81-4D99-BECC-D1B55A86D94E" defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "BDD81F4D-6881-4A8D-94A7-E67410089EEB" |
Update 2: Fix for 10.6.7 and Mail 4.5
Update: Fix for 10.6.5 and Mail 4.4
Another OS X release, another broken GrowlMail bundle. I did a post just like this for 10.6.2. Check it out if you want more background on why this occurs.
Download a pre-patched GrowlMail.bundle and drop it in your ~/Library/Mail/Bundles/ directory1. If you want it available to multiple users on your system, use /Library/Mail/Bundles/.
If you use this method you’re all set; no need to use the command line solution below.
If you have already had your plugins disabled by opening Mail.app you’ll need to look in ~/Library/Mail (or /Library/Mail if you installed globally) and move the files back to the active bundles directory. They’ll typically be in Bundles (Disabled), so quit Mail, find them, and move them back into the proper directory.
If you have a local installation:
defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "E71BD599-351A-42C5-9B63-EA5C47F7CE8E" defaults write ~/Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "B842F7D0-4D81-4DDF-A672-129CA5B32D57" |
Global installation:
defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "E71BD599-351A-42C5-9B63-EA5C47F7CE8E" defaults write /Library/Mail/Bundles/GrowlMail.mailbundle/Contents/Info SupportedPluginCompatibilityUUIDs -array-add "B842F7D0-4D81-4DDF-A672-129CA5B32D57" |
Many new Wireshark users on Mac OS X run into an issue where no interfaces show up when trying to begin packet capture. If you attempt to manually input an interface (such as en0) this error will occur:
The capture session could not be initiated ((no devices found) /dev/bpf0: Permission denied).
To have the interfaces show up properly you’ll need to widen the permissions on the Berkeley packet filter (BPF). By default they look like this:
crw------- 1 root wheel 23, 0 Jan 31 13:47 /dev/bpf0 |
We need the filter to be readable by non-root, so open Terminal.app and run this command:
sudo chmod 644 /dev/bpf* |
Unfortunately every time you reboot this will reset, but if you are a frequent user of Wireshark you can add the ChmodBPF StartupItem to alter them automatically (available in the Utilities folder on the Wireshark disk image). To install you’ll need to follow two steps.
First, drag the ChmodBPF folder to the StartupItems alias in the same folder (or drag it to /Library/StartupItems directly). Type your password to authenticate and move the folder into the correct location.
The second requirement is only for 10.6+ users. Starting with Snow Leopard the security permissions of StartupItems are being enforced. Scripts that do not have the proper owner and group will receive this error:
Insecure Startup Item disabled. – “/Library/StartupItems/ChmodBPF” has not been started because it does not have the proper security settings
The proper security settings are ownership of the scripts by root and group of wheel.1 To set them:
sudo chown -R root:wheel ChmodBPF |
In Snow Leopard (Mac OS X 10.6) the Automator tool has been drastically upgraded to support the creation of service workflows. In simple terms, this means you can build automated chains of tasks that can be invoked in a context sensitive manner. Not simple enough? Using this tool, you can automate common actions you perform and the proper service will appear in the menu only when it is capable of being used. You can even assign global hotkeys (via the Keyboard preference pane) to your service. Let’s take a look at a simple service workflow so you can see how it’s done.
Open Automator (it’s located in your /Applications folder). You will be greeted by a sheet requesting a template for your workflow. Choose service.
You’ll now be greeted by the main Automator window. On the left you’ll see a Library and actions you can perform. On the right you’ll see an empty pane where you drag actions or files to build your workflow. Third party applications you have installed can expose additional available actions, so the list of available actions will vary for each user’s computer.
As an example, we’re going to build a service that allows you to select files in the Finder, automatically zip them, and attach them to a new email. To begin, change the drop down in the upper right from “text” to “files or folders” and change “any application” to “Finder”. This means that the service we’re constructing will accept files or folders from the Finder as input. Next we need to add our first action. To accomplish this type “create” in the search field in the upper left of the actions pane. This will live filter the available actions so you can more easily locate the “Create Archive” action. Once you’ve found it, drag and drop it to the right hand side.
After creating the zip archive we want to attach it to a mail message. Search for “new mail message” and drag and drop it below the first action. It will prompt you with a few dialogs (mostly for permissions to access your keychain), but when you’re done you should have the workflow below.
To test you can click Run, but you’ll receive a warning that states “This service will not receive input when run inside Automator. To test this service within Automator, add the “Get Specified Finder Items” action to the beginning of your workflow. Remove or disable the action before running the workflow outside of Automator.”. Hit cancel (there’s no point to running our service without input!) and add the “Get Specified Finder Items” action to the very top of your workflow. You’ll also need to add an item or two for testing.
To test the entire service, click Run in the upper right! You should see it create a zip file in the same directory as whatever files you specified, then open a new Mail message with your zip file attached.
If everything is working you can remove or disable the “Get Specified Finder Items” action and save your new service. Whatever you name it will be how it appears in your Services menu, so try to give it a descriptive name (something like “Create Zip and Email”). Now head to the Finder, select a file or folder, and click the Finder menu to see the Services submenu.
Success!
But what if you don’t want to use that submenu? OS X allows you to assign global shortcuts/hotkeys to any Service using the Keyboard preference pane in System Preferences. Go to Keyboard Shortcuts within it, click the services option on the left, then find your “Create Zip and Email” option on the right. To add a shortcut you’ll need to double click on the righthand side of the Create Zip and Email row. Once the text box appears, press the key combination you want to use to invoke this service. Try to choose one that won’t conflict with anything.
Automator has a great deal of power, so try experimenting with various actions to build your own ideal workflow. For example, I frequently parse SSL certificates in the course of my day, so I built this workflow to do it quickly and display the results in a text document in my editor of choice:
I also wanted a universal key combo to start the screensaver (which requires a password) so I could lock my computer quickly without using the mouse.
If you’ve got other service ideas or want to show off one of you’ve written drop a comment! It’s always great to discover a better/more efficient way to accomplish a task.