Selecting Dialog Box Options Using Keyboard on Mac OSX

I’ve been always annoyed with inability of selecting dialog box on Mac using keyboard like you can in Windows:

mac dialog

Thanks to this rather-old-post there’s actually a way to enable dialog box option selection / cycling using keyboard. Go to System Preferences -> Keyboard and select All Controls under Full Keyboard Access at the bottom:

mac keyboard shortcuts

Now there’s one less thing for which you shouldn’t take your fingers off keyboard from.

Installing GNU Toolchain on OS X 10.8

Having GNU Toolchain handy is always a good thing because you’ll never know when you have that urge to “download the source and compile it yourself”. However it took my a while to figure it out the first time I got my macbook air.

A lot of posts and forum threads suggest installing Xcode which come bundled with a set of toolchain, but apparently newer version of Xcode (v 4.4.1 at the time this post is written) no longer installs the binary into the standard location (/usr/bin, /usr/lib and so on) — instead it’s all placed inside /Applications/ to fit with newer App Store style packaging. This means you can’t access the toolchain from terminal shell.

Thanks to, the trick is once you’ve got Xcode installed, go to Xcode > Preferences > Downloads and install the Command Line Tools component.

How to Add Additional IP to a Network Interface on Mac OS X

See here for similar guide on Windows.

After half an hour surfing various pages, I’ve finally figured out how to assign additional IP to a network interface on Mac OS X (thanks to this apple discussion thread:

Adding another IP to your network interface is a handy way of running multiple instance of a process listening on the same port (eg: Tomcat container). This is very useful to perform High-Availability (HA) setup locally on laptop.

This guide is written against OS X Mountain Lion (10.8), but hopefully not that much different for older / newer OS X version.

  1. Open Network Preferences (System Preferences > Network). On the left list box each connection made through available network interfaces are listed. On below screenshot I have two connections configured for my wireless and bluetooth network interface respectively.
  2. On OS X you need to “duplicate a connection” to add an IP to an existing network interface. Typically you would add additional IP to your primary network interface (eg: your wireless or LAN card) so it’s reachable from other host in your network. In my macbook air, since it doesn’t have a LAN port, I used the wifi network interface. Select your primary network connection (“Wi-Fi” in my case), click on the gear icon at the bottom and select Duplicate Service… You might need to click the padlock icon first to perform administrative task.
  3. Enter a name for the new connection, eg: Tomcat NIC 2 and hit Duplicate. The new connection will be created. Although it’s a different connection, it still uses the same network interface (in my case the wifi network interface). Initially the connection might not have an automatically assigned IP.
  4. If the connection does not have an automatically assigned IP, assign it manually. From Network Preferences, select the new connection, and click Advanced… button. Go to the TCP/IP tab, select Configure IPv4 Manually, provide an IPv4 address and subnet mask. Ensure the IP isn’t already used in your network (you can check it using ping).

You can verify the virtual interface has been created by using ifconfig command. Notice in my case I have got more than 1 IP assigned to my wifi interface (en0)

$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
 inet netmask 0xff000000
 inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
 ether 70:56:81:c0:c1:4f
 inet6 fe80::7256:81ff:fec0:c14f%en0 prefixlen 64 scopeid 0x4
 inet netmask 0xffffff00 broadcast
 inet netmask 0xffffff00 broadcast
 inet netmask 0xffffff00 broadcast
 media: autoselect
 status: active
 ether 02:56:81:c0:c1:4f
 media: autoselect
 status: inactive