User Functions


Don't have an account yet? Sign up as a New User
MM on Frapper
Check out our Frappr!
What's New:
No new stories

COMMENTS last 2 days
No new comments

TRACKBACKS last 2 days
No new trackback comments

Media Gallery Last 7 Days

LINKS last 2 weeks
No recent new links

There are no upcoming events
Borrowing Icons with Terminal

Disk image files (.dmg) are a popular way to distribute Mac software. Normally, when the disk images are mounted, they appear on the desktop as a boring white hard drive. But sometimes, the desktop icon features a colorful, custom icon. This tutorial will show you how to capture those custom icons for addition to your own library. The only tool you will need for this is the Mac Terminal, which is located in the Applications/Utilities folder.

The example I'll be using in this tutorial is Camino, a special Mac-only web browser from Mozilla. The icon itself is the standard white drive with a blue tribal-looking symbol on it, which resembles a sparse version of the program's logo. If you're following along at home, you'll need to download Camino from Mozilla and save it to your Desktop. The file you get will be "Camino-1.6.1.dmg". Double-click on it to mount the "Camino" disk image.


If you open up the Camino 'drive,' you'll see the Camino browser, a ReadMe file, and the Release Notes. The icon file is in there too, but it's hidden. How can we find it? Using the Mac Terminal. When you open up Terminal, you'll be in your home directory. To see what's there, type "ls" and press enter. A list of all the files and directories in your home directory will appear.

90:~ lholcombe$ ls
Desktop Incomplete Movies Public Thumbnails
Documents Library Music Shared cvsco.log
Downloads LimeWire Pictures Sites mozilla

If you've never used the Terminal before, you may not understand what you're seeing. That chunk of text next to your cursor is called a 'prompt', and it gives your location and your username. In this case, your location is "~", which is a shortcut symbol for your home directory. If you want to know the exact location of your home directory, try "echo ~".

90:~ lholcombe$ echo ~

So what we want to do now is go and find that Camino. It's on the Desktop, right? Let's go over there and look. Change directories ("cd") to the Desktop, and then list ("ls") the files:

90:~ lholcombe$ cd Desktop
90:Desktop lholcombe$ ls
Camino-1.6.1.dmg newpics unsorted workarea

Not there! The .dmg file you downloaded is there, but the mounted disk image isn't there. Then again, neither is your hard drive. Truth is, they're not actually stored on your Desktop, they just happen to be displayed there. If you "cd" over to /Volumes, you're sure to find it, along with your hard drive and any other attached devices:

90:Desktop lholcombe$ cd /Volumes
90:Volumes lholcombe$ ls
Camino DeepThought Eddie Marvin Slartibartfast

Now we can "cd" to Camino and see what's in there. Just like before, there's not a whole lot in there - just the app and a couple of text files.

90:Volumes lholcombe$ cd Camino
90:Camino lholcombe$ ls ReadMe.rtf Release Notes.rtf

Okay, here's the neat little trick. When we use "ls" to list the files, we're not looking at all the files. By default, a file that starts with a period is hidden. The way to show these files is by using "ls" with the "-a" flag, which you can think of as "listing all".

90:Camino lholcombe$ ls -a
. .DS_Store .background ReadMe.rtf
.. .VolumeIcon.icns Release Notes.rtf

There's a lot more stuff in there now. Including an icon file! That's the one we want to grab, so let's use the copy command ("cp") to copy it to our home directory. The syntax of the copy command is like "copy WHAT to WHERE".

90:Camino lholcombe$ cp .VolumeIcon.icns ~

In case you didn't know, the Mac is case sensitive, so make sure to capitalize the right letters. After copying, we can switch back to our home directory and verify that the copy was successful.

90:Camino lholcombe$ cd ~
90:~ lholcombe$ ls -a
. .Xcode .htaccess.old .spumux Movies
.. .adobe .jedit .tcshrc Music
.CFUserTextEncoding .bash_history .lesshst .viminfo Pictures
.DS_Store .config .macports Desktop Public
.Editra .cups .mozconfig Documents Shared
.MacOSX .dvdcss .mplayer Downloads Sites
.Trash .fontconfig .profile Incomplete Thumbnails
.VolumeIcon.icns .gnome2 .qsdkrc Library cvsco.log
.Xauthority .htaccess .recently-used.xbel LimeWire mozilla

Don't worry if you don't have as much stuff in your home directory as me - all we need to be concerned with is whether the file was copied over successfully, and you can see that it was.

Our next step is to rename it to something a little more user-friendly, something that shows up in the Finder. We use "cp" for that also. This time our copy command is "copy WHAT to WHAT", and afterwards we can use "ls" to verify the change:

90:~ lholcombe$ cp .VolumeIcon.icns VolumeIcon.icns
90:~ lholcombe$ ls
Desktop Incomplete Movies Public Thumbnails mozilla
Documents Library Music Shared VolumeIcon.icns
Downloads LimeWire Pictures Sites cvsco.log

Now you've got a fancy icon in your home directory that you can edit in Iconographer or use on your Desktop. Quit Terminal and use your mouse to explore this fun little file further.

For more information on how to do other cool things with Terminal, check out these sites:

Note: the Camino disk image icon used in this example is copyrighted. You are allowed to use this art for only a limited time, and in limited ways. Redistributing it is a violation of copyright law in most countries, and may be a violation of your fair use privileges. As such, this tutorial is for personal home use only.

Comments 0 comments | Borrowing Icons with Terminal Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Best Viewed on a Mac | Suggested Browser: Whatever floats yer boat.