Tag Archives: osx

Mounting and un-mounting external drives without plugging/unplugging in OS X

I have a 500GB MyPassport drive I use to clone my Mac’s internal drive, it’s plugged into one of the USB ports behind my Apple Cinema Display. After I eject/un-mount the drive I don’t want to unplug and re-plug the USB cable to re-mount the drive, I can re-mount it in Disk Utility, but that’s still kindda annoying, so I looked and here’s how you do it in the command line.

When you have the drive mounted, do a df to see what the device is:

[ProBert:~] ayn% df
Filesystem    512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2   976101344 427449800 548139544    44%    /
devfs                220       220         0   100%    /dev
map -hosts             0         0         0   100%    /net
map auto_home          0         0         0   100%    /home
afp_0TT7Xo1noyS900m5Am0Pyetl-1.2d000017 1949330784 1365867776 583463008    71%    /Volumes/Time Capsule
/dev/disk2s2                            1949330720 1365933248 583397472    71%    /Volumes/Backup of ProBert
/dev/disk1s3   976510944 427839352 548671592    44%    /Volumes/AYN MBP Clone

The device name is /dev/disk1s3 in my case. After that, you can mount and un-mount in Terminal easily by doing this:

[ProBert:~] ayn% diskutil unmount /dev/disk1s3
Volume AYN MBP Clone on disk1s3 unmounted
[ProBert:~] ayn% df 
Filesystem    512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2   976101344 427449672 548139672    44%    /
devfs                221       221         0   100%    /dev
map -hosts             0         0         0   100%    /net
map auto_home          0         0         0   100%    /home
afp_0TT7Xo1noyS900m5Am0Pyetl-1.2d000017 1949330784 1365867776 583463008    71%    /Volumes/Time Capsule
/dev/disk2s2                            1949330720 1365933248 583397472    71%    /Volumes/Backup of ProBert
[ProBert:~] ayn% diskutil mount /dev/disk1s3
Volume AYN MBP Clone on /dev/disk1s3 mounted
[ProBert:~] ayn% df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   465Gi  204Gi  261Gi    44%    /
devfs          111Ki  111Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
afp_0TT7Xo1noyS900m5Am0Pyetl-1.2d000017 1949330784 1365867776 583463008    71%    /Volumes/Time Capsule
/dev/disk2s2                            1949330720 1365933248 583397472    71%    /Volumes/Backup of ProBert
afp_0TT7Xo1noyS900m5Am0Pyetl-1.2d000017  930Gi  651Gi  278Gi    71%    /Volumes/Time Capsule
/dev/disk2s2                             930Gi  651Gi  278Gi    71%    /Volumes/Backup of ProBert
/dev/disk1s3   466Gi  204Gi  262Gi    44%    /Volumes/AYN MBP Clone

Using SSHKeychain’s key agent in terminal/shell

I’m not sure why I had to do this even if I told SSHKeychain to manage my environment variables, but anyway, to use SSHKeychain’s key agent in a shell, you do this:

Look up the socket location in preferences, it should look like this:

Preferences - General
Uploaded with plasq‘s Skitch!

and set the SSH_AUTH_SOCK environment variable in your shell to that location, you then should be good to go.

Flip Ultra and easy way to make Mac icons from images

So we got a Flip Ultra, when you plug it into the USB port it shows up with an ugly default USB drive icon in the desktop. I wanted to change it to a picture of the Flip Ultra itself. I googled on how to make Mac icons and found this post. It involves using either a PS plugin or Icongrapher. I tried that and it was a bit too much work to just make an icon.

It then occurred to me that I can just look at the info (?-I) on any image file, clip on the icon in the File Info dialog, ?-C that, go to the File Info dialog of thing I want to change the icon for, and ?-P to paste that in. Real simple!

FLIPVIDEO Info
Uploaded with plasq‘s Skitch!

Now I should really make that image transparent so it looks better. We love the Flip btw, super easy to use, quality is pretty damn good too. If you get one use one of these links…

😉

(your RSS readers might not show embedded iframes so see the post in the browser if you don’t see anything)

using Quicksilver to get TinyURL

If you use Twitter you probably use TinyURL to shorten your URLs pretty often, I looked into doing this with Quicksilver, there are a couple of blog posts that show you how to do it, but none of them I really liked. One even said it was crap himself in the beginning of the post.

What I really want is this:

  • I would copy the URL I want to shorten to my OS X clipboard
  • I run something in Quicksilver
  • The clipboard will be updated with the shortened URL

This turned out to be extremely easy to do. Here’s a Ruby script that does exactly that. If you make the script executable, Quicksilver should include it in its catalog. So just copy a long URL into your clipboard (?-C), invoke Quicksilver, type the filename (I just type “tiny”), and wola, your clipboard will have the TinyURL so you can paste (?-V) it into wherever.

#!/usr/bin/env ruby
require 'net/http'
require 'uri'

def shorten(url)
  Net::HTTP.get_response(URI.parse("http://tinyurl.com/api-create.php?url=#{url}")).body
end

IO.popen('pbcopy', 'w').puts "#{shorten(IO.popen('pbpaste', 'r+').read)}"