Superior bash tab completion in OS X

Posted by Tim Connor Fri, 23 Mar 2007 03:47:00 GMT

As a precursor to my upcoming subversion URL completion (I’m still working on the patch), I’m posting about the really cool prerequisite, bash_completion. This is improved, over what is included by default in OS X, extensible tab completion. It does things like limiting options based on the cmd (only listing directories for the “cd” command”) and hostname completion for ssh. It also allows for customizable completion for any command, which is the basis of the forthcoming URL completion.

Since it’s not included in the base OS X install, you need to install it yourself. You could go about this a variety of ways, but I went the DarwinPorts route. After installing Xcode, and DarwinPorts, and then using that to install bash_completion (all actually pretty easy), I sourced the file in my .bash_login
source  /opt/local/etc/bash_completion
I’d recommend dropping the most up to date subversion bash_completion script into the bash_completion.d and it will overwrite the default behavior.

Code snippet formatting temporarily broken

Posted by Tim Connor Thu, 22 Mar 2007 17:09:00 GMT

Or why not to run on HEAD

I manually coded in the < pre>< code> block for the last post, but older articles will be temporarily FUBAR.

Hiding the Bootcamp partition

Posted by Tim Connor Wed, 21 Mar 2007 17:19:00 GMT

If you have a bootcamp partition, but don’t need frequent access to the partition, you may not want it showing up all time, cluttering up the Desktop/sidebar, and potentially letting other users accidentally mess up your Windows install. While Parallels is running it hides the Bootcamp partition (at least if you are running the Parallels from Bootcamp option), but the rest of the time….

You can prevent the partition from being mounted easily enough by editing your fstab file. Those of you used to a more traditional Unix/Linux may be shocked to not find a file at /etc/fstab in the first place. Go ahead and make one, ignoring the /etc/fstab.hd file. In your new fstab you can just put the instructions for the noauto windows partition – that will leave the rest handled as usual by OS X. The following are the contents of mine, for handling my FAT partition.


LABEL=WINDOWS  none     msdos  rw,noauto

Quicksilver + Backpack for the win! 1

Posted by Tim Connor Mon, 19 Mar 2007 22:44:00 GMT

Apparently, I’m behind the times on trying Quicksilver. If you are on a Mac I definitely recommend downloading it giving it a full try. At first I thought it seemed sort of like a waste of time – I’ve never bothered learning the ins and outs of the various alternative launchers available for the Mac.

But once I actually read through the docs, fine-tuned my “catalogs” of verbs and nouns and gave it the ole college try, it blew me away. Quicksilver leverages the GUI to make the full effeciency of an experienced command line guru available to all, and extends such functionality far beyond the terminal. It’s tab completion for the GUI age.

This may not seem like much, to the uninitiated, but I just added a todo to my backpack page to blog about this with the following keystrokes (actually less than this, but I’ll complete the full words for clarity):

CTRL-SPACEBAR
todo>>
* No, really blog about QS + Backpack
TAB
Email To
TAB
Blog
ENTER
We’re not mousing around, here, folks.

Installing mod_proxy on a Mac OS X - Tiger 10.4.8 1

Posted by Tim Connor Tue, 13 Mar 2007 08:13:00 GMT

I’m using Locomotive for my easy Rails install/set-up on my new iMac and been relatively unbothered by not having to download, build, configure, and manage a herd of tools. I installed MySQL, rather than be restricted to the included SQLLite3, but that is simple with the nice installers available from the MySQL AB. Now, I’ve come across the first more complicated “upgrade.”

With the default Locomotive (mongrel) set-up you end up with paths like localhost:3000. This is fine when you only ever have one site running, but causes a problem wih conflicted sessions when you have one site at :3000 and another at :3001. Now many of you are probably familiar with the idea of using Apache as a virtual hosting front-end/proxy. If you do so, and edit your hosts file (or take a quick trip to the NetInfo Manager in OS X) to map http://your_app to 127.0.0.1 you have a much improved situation.

Unfortunately, most of the instructions involved in setting this configuration up, either explicitely presume an Apache 2 install, or walk you through installing it, and OS X comes with 1.3. In the middle of developing a couple apps you may not wish to take time off to fully configure and mess with a full web server upgrade. It’d be much nicer to just add mod_proxy (the one missing piece), configure your vhosts, and call it good.

Figure out your apache version

shell$ httpd -v
Server version: Apache/1.3.33 (Darwin)
Server built:   Aug 19 2006 07:55:18
Grab it from the archive and unzip

shell$ curl -O http://archive.apache.org/dist/httpd/apache_1.3.33.tar.gz
shell$ gnutar -xzf apache_1.3.33.tar.gz
Use apxs to build and install mod_proxy

sudo apxs -c -i src/modules/proxy/mod_proxy.c
Configure and you’re off (remember to uncomment the LoadModule and AddLoader)

<VirtualHost *:80>
        ServerName your_app
        ErrorLog /dev/null
        CustomLog /dev/null common
        ProxyPass / http://127.0.0.1:3000/
        ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

Parallels and Bootcamp - Take 2

Posted by Tim Connor Mon, 05 Mar 2007 20:13:00 GMT

So after getting my iMac back I, of course, wanted to give it another try. This time I did the bootcamp thing first, in case there were any problems. It went smoothly this time – with a new full price retail box of XP Pro.

I partitioned the drive with the Bootcamp assistant, and noticed that it seemed the Apple Store ripped me off, as the drive only indicated 200 gigs on a “250” gig drive (which is actually 230, of course, depending which way you count gigs – it’d be nice if Apple could be consistent between what their software displays, and what the specs/marketing say, of course). Once I got into the Window installer, though, there was a 200 gig untouched partition in addition to the Windows partition. So the 200 gigs was the Mac partition, and there was probably already a Windows partition. It seems to me this means that either they just reinstalled OS X, gave me a $0 warranty receipt, and kept the drive, or Apple actually pre-tested the drive to work with Bootcamp. I’m leaning towards choice number one – but no skin off my nose.

Windows installed as normal – boy it is weird to boot an iMac into Windows. I installed the Bootcamp drivers, but tried not to update Windows any more, so I’d have a base system. The auto-update went through, despite my unchecking it, but fortunately it didn’t seem to update IE any further, which was my main concern (since I am doing this mostly to have IE to test pages with).

Booted back into OS X, and downloaded the newest beta (Release Candidate 3) of Parallels. Installed that, told it to make a VM using the Bootcamp partition, and wallah, we were (basically) done. They even have seemed to fixed the windows reactivation problems, probably with hardware profiles. I didn’t even have to activate Windows again the first time I booted it virtually into Parallels (the docs said you might have to once).

So that I could update this copy of Windows fully, without losing my base IE, I made a fully virtual copy for another VM. Parallels Desktop ships with an additional product Transporter, that lets you migrate a non-virtual install, such as the Bootcamp one to a virtual hard-drive copy. And since my main VM ran off of the hard-drive, it is essentially a “real” install, that just happens to be run through some additional software.

To cut to the chase, I installed the Transporter Agent on the harddrive Parallels VM, and started up Transporter. After a while it was done, and I had an additional VM to play with. Of course, this version does run afoul of activation issues, but I am sure that some people out there could find ways around the activation problems on the additional virtual copies, such as re-keying those copies, or something, if they cared to.

Bootcamp related Mac white screen of death 36

Posted by Tim Connor Sun, 04 Mar 2007 01:13:00 GMT

DO NOT attempt to install a pre-SP2 version of Windows XP on your Bootcamp partition. I don’t know if this happens to everyone, but I definitely found a number of forum and blog posts about it. It may be coincidence and actually be due to a hardware failing, as Apple claims, but it seems like a lethal software bug from my experience and reason.

I don’t even know how this could actually be true, because I didn’t know that SP2 messed with the installer that much, but some some of our experiences validate the theory. The trail to the bug starts when one boots into the Windows install sequence, and it won’t detect the partitions right. Instead of seeing the main partition and a (in my case) 32 GB partition the Windows installer claims there is one 132 GB (or so). Not wanting to mess up their entire computer, most people take the logical step of backing out of the Windows install and rebooting.

At that point I was greeted with a lit but blank screen. Not even the apple logo. Just white nothingness. I rebooted a million times, with different install disks in and different command sequences held down. I cleared the PRAM. I did everything that support would later ask me to do, to no avail. If you hold down the Alt/Option key to get the boot menu, you get the slightly off-white sceen, with no choices on it, just blank. If you hold down ‘x’ to force a boot into OS X, you get a black screen. Nothing works – call support and then they’ll tell you to take your computer in for service.

It seems to me, and others in my camp that Bootcamp is messing with the boot loader to tell it to boot into Windows for the install, and when you back out, due to the non SP2 misreading the partitions (this isn’t a bug exactly, since the requirements tell you to use SP2 or later), it refuses to boot into anything else. Since you didn’t install Windows, though, it can’t boot into that.

Now it’s possible this theory is entirely wrong. Maybe it is actually a hardware problem that prevents the drive from being partitioned correctly, and the Windows install disk was reading it correctly. That, of course, wouldn’t explain why it wouldn’t run the install from the external drive they tried at the Apple Store.

Of course, I could test this by attempting to install from the same Windows disk when I get my computer back, but I think I’ll play it safe and not. And before anyone suggests Paralells, I already have it. I wanted to use the new feature where you can run the VM from the Bootcamp partition, so you only have to maintain one main install, both for running natively through Bootcamp for performance reasons (like if you want to game), or virtually with Paralells.

Older posts: 1 2