Home > Mac, My Software > iTerm with Genders

iTerm with Genders

December 15th, 2008

I modified the latest iTerm 0.9.6 source to add support for Genders. If you do not know what Genders is, its a an API to query a database for a list of hosts that satisfies a gender or tag. If you work with many clustered hosts, you will probably be interested in Genders and its integration to iTerm.

You can find more information on Genders specifically here.

Setting Up Genders

Before you can use Genders, you will need to define a gender database. This is just a text file of nodes and genders. You can also do simple expansion of instances.

For example, /etc/genders (or ~/Library/Preferences/genders) would contain:
web-[01-04] node,web,linux
db-[01-02]  node,db,solaris
app-[01-04] node,app,linux

This concise file defines 10 hosts with six genders. All of these hosts are nodes. Some run linux and others solaris. Each host is also tagged with its function: web, db, or app.

 

My modification to iTerm uses Genders to create a dynamically generated bookmark list similar to the Bonjour bookmarks. Inside the list, either in the menu or sidebar, you will see a list of genders that contain hosts that match.

 

 

 

 

 

In the menu, you can see that all the nodes are sorted by gender. This makes searching and selecting nodes by gender very intuitive. All nodes of a gender can be opened by selecting Open All. Then enable File > Send Input to All Tabs and you can easily manage a dozen of nodes as easily as you can one.

Here is the bookmark side bar fully expanded to show how the nodes are arranged by gender.

All of these bookmarks were generated by parsing the short 3 line genders file.

 

Customizing iTerm with Genders

Certain genders beginning with “@” act as keywords to iTerm to set bookmark attributes. The special keywords are:

  • @Display
  • @Command
  • @Keyboard
  • @Terminal
  • @Shortcut
These keywords directly correspond to the bookmark attributes and are set when iTerm is launched. Here is what a Genders file will look like, using the special attributes.
web-[01-04] node,web,linux,@Display=web,@Terminal=xterm
db-[01-02]  node,db,solaris,@Display=db,@Terminal=vt100,@Command=telnet
app-[01-04] node,app,linux,@Display=app,@Terminal=xterm
The default @Command is “ssh”.

Notes

  1. Genders returns only the node hostnames and not the domains. If nodes span multiple domains, the domains must be added to the Search Domains in either the System Preferences or /etc/resolv.conf. Needless to say, node hostnames must be unique.
  2. Mac OS X has a limit of eight search domains. If you exceed this limit, you will need to add hosts and IPs to /etc/hosts. You probably wont run into this issue unless you are a very large network. Any more than a few search domains will drastically increase your connection times, so you might want to add your nodes to the /etc/hosts file anyway if you regularly use more than a few domains.
  3. Current implementation of iTerm with Genders does not dynamically reload the genders file if it is changed. iTerm with Genders must be relaunched. I hope to address this when I get a chance.
  4. Errors loading the genders file will be silent. If the Genders bookmark item is missing, there was probably an syntax error in the genders file.
  5. Ignore the Sparkle update notifications or you will overwrite the Genders mod.

Bugs and Comments

Please post any bugs and feature requests pertaining to genders & iTerm in the comments below.

Downloading iTerm with Genders

iTerm with Genders is an informal fork of iTerm 0.9.6. My hope is to get it merged with the official release of iTerm. Until it is merged, here is the Mac OS X Leopard Intel binary and source code. All software iTerm, libgenders, and my DEGengders libgenders cocoa wrapper is distributed under the GNU license.

itermgenders-096 (Mac OS X 10.5 Leopard (x86 Binary)

iTerm with Genders 0.9.6 Source Code

Mac, My Software ,

  1. No comments yet.
  1. No trackbacks yet.