Minimalist X window managers – xmonad on Apple OS X Snow Leopard (10.6)

This post will outline the steps you can use to build xmonad cleanly on a Snow Leopard system.

This is a follow-up post to our prior post on minimalist X window managers on OS X which addressed xmonad and ratpoison on OS X Leopard.

The rationale and benefits of a simple and clean X11 window manager on OS X are outlined clearly in that post.

Thanks to baconpiggypiggy for testing and sharing test patches for making this work on Snow Leopard, in the interest of more efficient desktops everywhere.

It was previously possible by bootstrapping binaries from previous OS X builds, various source patches, etc., but it is quite exciting to have it available for simple and easy setup. These steps should work whether you are booting into 32-bit or 64-bit mode.

The steps are as follows:

1. Be running a relatively vanilla Snow Leopard installation.

2. Run the “Optional Installs” installer from the Snow Leopard media. Under “Applications”, find “X11″ and install it on your system.

3. Install Xcode from the Snow Leopard media.

4. Run Software Update to address any Xcode updates.

5. Download and run through the installer for the Glasgow Haskell Compiler (GHC) (latest is version 6.12.1 as of posting).

6. Launch Terminal.app and run this script to install the Haskell X11 library

cd /tmp
umask 022
curl -O http://hackage.haskell.org/packages/archive/X11/1.5.0.0/X11-1.5.0.0.tar.gz
tar xfz X11-1.5.0.0.tar.gz
cd X11-1.5.0.0
runhaskell Setup.hs configure
runhaskell Setup.hs build
sudo runhaskell Setup.hs install

7. Run this script to install the Haskell MTL library:

cd /tmp
umask 022
curl -O http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/mtl-1.1.0.2.tar.gz
tar xfz mtl-1.1.0.2.tar.gz
cd mtl-1.1.0.2
runhaskell Setup.hs configure
runhaskell Setup.hs build
sudo runhaskell Setup.hs install

8. Run this script to install xmonad:

cd /tmp
umask 022
curl -O http://hackage.haskell.org/packages/archive/xmonad/0.9.1/xmonad-0.9.1.tar.gz
tar xfz xmonad-0.9.1.tar.gz
cd xmonad-0.9.1
runhaskell Setup.lhs configure
runhaskell Setup.lhs build
sudo runhaskell Setup.lhs install

9. Launch X11, and set a few settings in preferences. On the “Input” tab, ensure that only the following two options are checked: “Emulate three-button mouse”, and “Enable key equivalents under X11″. Close X11.

10. Pull down awesome X11 fonts from proggyclean.

11. Save them in ~/Desktop/fonts/ or a directory of your choice. Gunzip the PCF files.

11. Run mkfontdir in the directory to create a fonts dir file.

12. Copy over the stock xinitrc: cp /usr/X11/lib/X11/xinit/xinitrc ~/.xinitrc

13. In ~/.xinitrc, comment out the if/for loop that runs the stuff in /usr/X11/lib/X11/xinit/xinitrc.d/ twm, clock, and the xterms.

14. Append to ~/.xinitc:

/usr/X11/lib/X11/xinit/xinitrc.d/10-fontdir.sh
xset fp+ ~/Desktop/fonts
xset fp rehash
cd
quartz-wm --only-proxy &
/usr/local/bin/xmonad &
xterm

15. Create ~/.Xmodmap with the following contents:

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
add Mod1 = Meta_L
add Mod2 = Mode_switch

16. Create ~/.Xdefaults with the following contents (adjust the font name if you selected a font other than ProggyTiny with slashed zero):

XTerm*font: -*-proggytinysz-medium-*-*-*-10-*-*-*-*-*-*-*
XTerm*reverseVideo: on
*VT100*reverseVideo: on

17. Launch X11. Enjoy!

A couple of notes:

  • Cut and pasting:
    • within X11 only, you can highlight text and it will be placed on the clipboard
    • to put it on the clipboard for aqua apps, hit command-c as usual with aqua apps
    • to paste within X11 (from either X11 or aqua), just use option-click or middle-click
  • window and virtual desktop layout:
    • ctrl-n – new xterm
    • option-1 through option-9 will take you through different workspaces in xmonad, which are independent of OS X “spaces”
    • option-. and option-, will rotate and redo tiling of windows

This setup and tmux are a winning combination for maximum OS X command line efficiency.

Author: George Lewis

Topic(s): How to,Technical

Published: March 5, 2010 00:32





Oracle on ZFS

Oracle on SPARC is a very common sight.  Most people who run SPARC run Solaris.  Sun Microsystem’s (now Oracle’s) SPARC and Solaris make for a well performing and stable platform for their Database Management System (DBMS).  Solaris 10, which has been out five years now, has brought into being many great features.  ZFS has been out for quite a while (not the initial release, however), and has also had tremendous growth in features, stability, and performance.  For years, I’ve resisted putting Oracle on ZFS.  The main reason is that ZFS is new.  Storage, above all, must be 100% correct.  ZFS is designed with this in mind, but despite the best efforts of the ZFS team, things do go wrong and recovery tools are not generally available.  Storage folks are a very conservative lot and “bleeding edge” makes many of us nervous.  The close-second reason is the Adaptive Replacement Cache (ARC) being stuck on.  The ability to bypass the ARC on a file system basis was introduced in Update 8 of Solaris 10.  The third reason is that ZFS is a Copy-On-Write file system.  That means every time a block is written, a new one is allocated and then linked in with the previous block becoming unlinked.  ZFS does this to ensure your write makes it to disk and that the file system metadata is always intact.  Fair enough, but I imagined a database fragmenting badly and quickly.  Knowing all of this, I decided it was time to put Oracle on ZFS (I’ll discuss the fragmentation in a minute) because it could help greatly in the problem I needed to solve.

The problem is this:  The organization uses an Oracle standby from the production database to create a reporting datamart.  They did this by stopping the standby, exporting custom tables from the reporting database, copying the standby database to the reporting database directories (over 300GB copied), modifying the reporting copy to be a reporting database, loading the tables back and starting standby again.  Wow.  The DBAs have their reasons for the database portion of it, but copying 300GB of data means that the SAN behind it (and the server!) has to move 600GB of data.  Oh, this was happening every night and took hours.

ZFS supports persistent snapshots and clones (writable snapshots).  As an added benefit, it also has privilege delegation.  With the ARC bypass firmly in place (along with block size changes), I was able to work with a DBA to put the standby database on a ZFS volume.  Instead of the four hour copy, an almost instant snapshot and clone is made.  The whole process (extraction of tables from reporting, snap, clone, transform, and load) now runs in less than 30 minutes and the DBAs have complete control over the process.

This setup has been in place now for several months bearing full load from users.  So far so good.  The SAN isn’t moving a mass amount of data every night, less storage is allocated, since two full copies are no longer needed and the system is using the CPU cycles to process other datamart activities.  If fragmentation becomes a problem, we can make a copy of the database, one file at a time.  After all, this is the way the organization used to do it.  Again, so far, no complaints have been made about the new setup.

ZFS is still evolving.  Features like de-duplication are coming.  I am hoping that block pointer rewrite becomes reality.  I’m sure many Solaris users will be happy to make the switch from the more traditional setup of Veritas Volume Manager and VxFS/UFS (aside from Oracle ASM, that is)..myself included.

Author: Barry Freese

Topic(s): Review

Published: February 2, 2010 07:50





So, you’re thinking about a SAN… (part 3)

Now that the transport has been established, the next decision is what storage system(s) to use to provide the data.  For most, this decision has the most impact on performance.  Controller performance, either in throughput or in Input/Output Operations Per Second (IOPS), number of spindles (physical disks), type of disk (FC, SATA, SAS, SSD, etc.), and the layout of those disks all come in to play.  Most storage arrays support a mix of disk types, so ensure that the controllers can keep up with the IOPS load in the storage configuration you want to provide (probably the biggest “set in stone” decision to make).  Some arrays are more flexible: you can add more controllers later on if you find out that the controllers are being stressed somewhere (cache, CPU, back-end IOPS, etc.).

The type of data you plan to store and the user expectation for how it will perform determine what disks are used in the array.  SATA is great for low performance, high capacity storage.  SATA does well with low IOPS and low contention (since seek times are generally higher than others and other features aren’t as advanced or are lacking) and so they serve archive or small workgroup storage well.  SAS and FC do well for high IOPS loads (high-volume e-mail, OLTP databases, etc.) but tend to have a high cost.

Once you pick a disk-type for a particular work load, how do you choose a volume format?  DBAs will always tell their SAN admin not to use RAID-5 because of the overhead to calculate parity for each write operation.  Well, maybe.  The reality comes down to user expectation.  If your array will deliver your cruelest database loads in adequate time running on RAID-5, what’s the problem?  If RAID-5 suffers, then RAID-1+0 it is.  With database workloads, it’s often not as simple as that.  Given the cost of SAN storage, making the most of it counts for a lot.  If there is a particular part of the database that could benefit from faster storage, it may be beneficial to put things like redo logs on the fastest configuration you can configure and put the database on something a bit slower, but more space efficient, and the archive logs (depending on how long you want to keep them and how fast they get created) on something more cost efficient.  Database systems like Oracle have excellent tools for determining what part of the database needs help.  I can also assure you, DBAs have a knack for letting the storage folks know when they need something.

When it comes down to allocating the storage out to the hosts, I try to allocate what is needed plus a small overhead.  Some operating systems are okay with the idea of growing a volume/LUN (Windows) and others are not (Solaris).  For those that are not, I recommend the use of volume management software that will allow you to add additional LUNs and grow the file system (Solaris does allow for this, for example).  Some storage arrays provide the notion of Thin Provisioning to work around this concept.  Personally, I oppose the very idea.  Thin Provisioning is a lie.  The array tells the host the volume is bigger than the amount of actual storage backing it up.  So long as the host doesn’t want to use all that storage, all is good.  (Does this remind you a bit of some financial scandals?)  If, however, the host decides that it needs that space, it is either allocated on demand or if there isn’t enough to be allocated, the write fails.  A SCSI write failure is bad because it means your file system is now corrupt.  The hope is that storage use will grow slowly enough that the SAN admins, who are hopefully paying attention, can add more storage to the array before the situation becomes critical.  There are a lot of “ifs” in this whole concept.  This whole thing relies upon the idea that 1. The SAN admin can add storage in a crunch (which means money from somewhere) 2. Everyone who is using the storage remembers that the numbers they see are lies and they don’t really have that much space, so plan accordingly and don’t do anything stupid, and finally 3. Nothing goes wrong.  By the third point, I mean that some job runs away dropping core files or a database autoextends itself blissfully because no one put an upper cap on it, or someone isn’t told the numbers aren’t right and they use the space “temporarily”.  Once TP space is allocated, it’s allocated.  The storage array has no way to know that a block has been freed since “zeroing” blocks isn’t generally done (we’ll get to this same idea with SSDs in the next section).  There is also an issue of resource consumption and human nature.  When people know where the hard wall is, they’ll respect it (as do file systems in that they leave themselves enough room to work and not get corrupted).  If people know that there is a limit out there somewhere (and who knows because there might be other TP users on the same array about which they have no idea), but not sure where, they might be tempted to gamble.  In any case, TP can put the SAN admins in a tough spot.  TP is sold by marketing folks as a storage saver (wait, you mean to tell me marketing people selling storage are trying to keep me from buying storage?  Something’s not right.  Oh, that’s right; they know if you lie to your users, that lie will catch up to you and you’ll come running to them at the last minute for more disks which will be a guaranteed sale!), but it is simply this: if SAN admins have to keep space free on the array to account for the possibility of TP growth vs. space free in file systems that goes unused, that space is still free (and wasted).  Smart planning and flexibility from volume managers on the host side can mean that you don’t need TP and you’re not wasting a lot of space either.  It will also help the SAN admins sleep better at night.

Now that we’re past all that, the last thing to remember with allocation is to have your application, be it a file system, DBMS, mail system, whatever, use the storage wisely.  By that, I don’t just mean space; I really mean understanding what’s underneath.  Issue read/writes in multiples of stripe widths (just the data piece, not parity, if any).  There is no magic bullet for this (as it depends entirely on how the admin configured the volume) and controllers in arrays can make up for some of this.  Make no mistake, a mis-alignment can cause a lot of undue stress on your storage.  For example, it used to be the case that the default start of an EFI disk in Solaris is misaligned if the LUN came off hardware RAID.  Ugh.  Pay attention.

In conclusion, the decisions made come down cost, both in equipment and in skilled people or support contracts, and workload/application.  There are examples of successful deployments for all the technologies mentioned in the previous posts.  Personally, where cost is no issue, I’m biased towards Fibre Channel.  That is not to say that I would pick it every time; I always try to choose the right tool, even though it may not be my favorite.  For example, there’s no point in moving an ant hill with a bulldozer.  If you want to create a low-load two node cluster, running a FC SAN is serious overkill because a couple of SCSI JBODs will do just fine.

Looking towards the future, the enterprise storage array is going to have some serious competition.  There are lots of exciting changes in storage going on currently.  There is the notion of object based storage (leaving behind the traditional general file system) and solid state disks (SSDs) maturing.  Object based storage is a completely different concept, but SSDs are not.  They’re still block-level storage devices, just faster.  SSDs are starting to see adoption in storage systems already (Sun is doing this) and is being made available into the general OS (Sun also doing this with ZFS in Solaris/OpenSolaris).  SSDs in ZFS are configured as a cache device, thus creating a hybrid pool of storage.  It’s a fantastic use of the technology.  When the SSD cost per GB reaches “good enough” and things like TRIM (the ability for the OS to mark a cell as unused so it can be erased — long story short, over time, SSDs themselves will lose track of what’s really used and what’s not which counts for true write size and wear-leveling) become universally implemented, storage may look a bit different.  Nonetheless, the present notion of a SAN and storage arrays still have a lot of great applications and many organizations can benefit from them.

Author: Barry Freese

Topic(s): Comparison

Published: November 8, 2009 21:07





So, you’re thinking about a SAN… (part 2)

Once you’ve decided that networked storage is the way to go, which option do you choose?  There are pros and cons to all of them, and picking the right tool for the job can make a world of difference.  Of course, that assumes money is no object.  For small organizations, especially in this economy, making do with what you have might be the only option.

NAS is a good choice for problems that span large areas, need to be shared, and where limited flexibility is acceptable.  For example: a college that needs a system to share out home directories is a great use for a NAS.  Students, faculty, and staff all need access to their files across the public network, and just about every OS on a desktop can use CIFS, NFS, or both.  NAS can also be a great option for low-cost shared storage or storage that needs to be provided over an unstable network.  The reason I say low-cost is that a NAS system can be a “roll your own” setup.  For example: Sun Solaris 10, Sun Cluster, and JBOD trays that support multiple initiators.  Highly available NFS and CIFS (via Samba) is ready to go.  The same can be constructed with Linux.  NFS systems can also be paired to backup systems through NDMP and spare the backup server some work.  NAS systems are also available from commercial vendors as a great option for those looking for something more turn-key.

That said, NAS has limitations.  You can’t be as creative with NAS as with block-level SANs.  A block level storage device coupled with basic volume management software in the host OS provide a fair amount of flexibility.  Example: When migrating from one disk array to another (the old array reached end-of-service-life), a new disk array was brought on-line, added to the hosts, storage mirrored using the host-side volume management, old storage detached, old array scrubbed, and old array shut down and rolled out the door.  The impact to the users of the ERP and E-mail system running on the old array?  Nada.  No one noticed.  Again, SANs provide block level storage.  You can build whatever file system you want, use Oracle ASM, or whatever else can make use of it; you’re not tied to a protocol or specific set of implemented features of a protocol (“Is that NFSv3 or NFSv4?”).

When considering the networking for block-level storage devices, keep in mind that generally block level storage  does not fail gracefully.  Storage, above all, has to be correct 100% of the time, so having a reliable network between host and storage is critical.  Performance is second to correctness.  There are lots of options for block level networking and vary greatly both in cost and performance.  Some of the choice here depends on the storage array and what it can provide.  For arrays that support ISCSI (which is a means of moving the SCSI protocol over IP networks), this can be a cheap block level network setup.  Solaris has an ISCSI target capability built-in, and that married to ZFS is great to get your feet wet with ISCSI (but there’s no redundancy, so I wouldn’t trust it for a production system).  Like NAS, this option can be implemented over your existing IP network (although I don’t recommend it) and cheaply since many operating systems have software ISCSI initiators.  There are hardware HBAs available too.  However, even with a dedicated back end network, it’s still an IP network which has shortcomings when it comes to storage.

Fibre Channel is a very widely deployed answer to the block level network problem.  This option is not exactly cheap.  Fiber Channel is a network, first and foremost, that was designed with storage in mind.  Concepts like flow control, “routing”, and loop detection are different.  Getting into Fiber Channel can be a bit pricey in that FC requires special switches and HBAs in the servers (not to mention cabling).  FC is usually implemented in duplicate (creating two different, disconnected networks called fabrics) so under certain conditions or even a fabric failure is a non-event to the servers.  FC also comes in a variety of speeds and, so far, has maintained backwards compatibility.  FC comes in 1Gb/s, 2Gb/s, 4Gb/s, and 8Gb/s.  Ethernet comes in 1Gb and 10Gb.  In my experience, 10Gb/s to the host is too much and 1Gb/s is too little.  Sure, things like port channels can work around some of this, but single link speed flexibility is a nice thing to have.  There is a lot of intelligence built into FC in the switches which provides the true beauty of FC.  One bit of wisdom with FC switches: don’t mix switch vendors.  Even switch vendors like McData and Brocade (Brocade bought McData several years ago) who have developed firmware to make each switch platform (M-EOS and FOS) play nicely with each other, still only have a limited set of features in compatibility mode.  Homogeneous fabrics make life easier and allow you to take advantage of features that would otherwise be disabled or limited.

Another option for storage networking is very new and being pushed by Cisco and Brocade:  the idea, called Data Center Ethernet, merges Ethernet and FC into one network. .  It’s a neat idea…on paper.  The advantage for organizations that deploy large FC networks is reducing cabling and switching costs because both types of data move over 10Gb/s Ethernet links.  The downside is that it requires special switches (you still have to have a fabric controller!) and special HBAs.  Unlike with FC, you can’t use your older, slower FC HBAs as part of a rolling upgrade (well, sort of), and the Ethernet port in your server won’t cut it either.  To be more clear, you can combine the DCE and FC systems together, but in order to move to DCE completely, you’ll need to buy all new HBAs.  I cannot say that I have any first hand experience with this technology.  It has been proposed to me by sales folks, and aside from the cost of adoption, it’s also a very new technology.  Going back to one of my first points, storage has to be right.  Bleeding edge and storage is a match I try to avoid.  I was also told that DCE is the future, to which my reply was “I was told five years ago that FC was dead.”  I assure you, FC isn’t dead.  Storage folks, in order to “keep it right”, like to keep it simple.  It’s nice to have a separate set of switches that do one thing and one thing well.  Cisco and Brocade may be on to something, but SAN architects are a very conservative lot so I suspect adoption will be slow.

There are other options from the “experimental” (like ATAoE) to the niche (InfiniBand with Lustre) .  NAS with either NFS or CIFS, ISCSI, and FC seem to be the leaders thus far in terms of install base.

Now that you’ve decided on what transport will meet your needs, our next installment will help you figure out what should dish out your data.

Author: Barry Freese

Topic(s): Comparison

Published: November 1, 2009 21:14





So, you’re thinking about a SAN… (part 1)

In most situations I’ve seen, moving to enterprise storage comes about as an evolutionary development.  This begins with systems administrators, who have lived with Just a Bunch of Disks (JBODs) scattered across a variety of servers, looking to change how their storage works.  How does an organization decide to move into centralized storage, especially today’s world of cloud computing?

What can a Storage Area Network (SAN) do for me?

  • Storage is usually the slowest part of any computer system, big or small.  Getting storage right can improve performance in a variety of applications.  Using a storage array allows servers to get the benefit of many spindles when they need it, and also allows intelligent controllers to be shared by multiple servers.
  • Speaking of multiple servers, storage arrays almost always support multi-host initiated virtual disks.  While this can be done with JBODs, the scale that is possible doesn’t compare.  Creating shared storage for clusters is easy.
  • One-stop-shop for data replication.  There are many data replication options out there.  Some applications will replicate their own data, some volume managers or file systems will do it.  Both of these options have big ifs and aren’t universal.  Having a storage array, or an intermediate device, replicate the data means the OS, file system, application, etc. doesn’t matter; the same replication strategy works for Windows, Linux, Solaris, AIX, and any other OS you can hook to the array.
  • Less waste.  You can allocate the storage you need where you need it and that’s it.
  • Just like with JBODs, you still have your hands on your data.

“If you build it…” but how?

There are many different options for building the storage communication network (or utilizing an existing network) for sharing storage.  In our installment, we’ll examine how to choose between a Network Attached Storage (NAS) solution (NFS or CIFS), or block-level SAN (ISCSI, Fibre Channel, Fibre Channel over Ethernet, etc.) .

Author: Barry Freese

Topic(s): Comparison

Published: October 28, 2009 21:43





Minimalist X window managers on Apple OS X Leopard (10.5)

Updates:

  • 3/5/2010 – Snow Leopard xmonad configuration detailed in this follow-up post
  • 12/25/2009 to fix several hours and point out functionality of Fluxbox and Blackbox on Snow Leopard.

Perhaps you have used a full-time *NIX box as your main desktop in the past.

In many cases, you will probably find that many of those folks are just using Apple machines now, due to the aesthetics of the hardware, ease of native use of Windows and *NIX applications, giving you the best of all three worlds (licensing is another topic . . . ).

This is a great way to stick with your normal OS X install, but be able to switch back to just X11 so you can have tons of windows open and be able to read everything quickly. This setup does not require any dual-booting, nerfing of copy/paste, etc.

I’ve been doing this with Leopard and Snow Leopard. I prefer xmonad, but haven’t succeeded in building it cleanly on fresh installs of Snow Leopard, so am providing two sets of instructions.

Ratpoison and xmonad are both very lightweight, minimalistic, fast window managers for X11. You’ll find that they both strive to be as simple and quick as possible to permit the fastest usage of lots of windows while allowing you to maximize the use of your screen real estate.

Ratpoison instructions will work for either Leopard or Snow Leopard. xmonad only works with Leopard at the moment, due to the 64-bit haskell compiler (GHC) build work being done for Snow Leopard.

They each allow you to dynamically create and remove workspaces that are independent within X11, and do not overlap with OS X’s “Spaces”.

xmonad stands out in a couple areas:

  • easy to rotate/resize/retile windows
  • a bit cleaner, simpler
  • mouse highlighting to switch windows

Try them out.

Other applications like tmux may be helpful to create another dimension of windows and flexibility.

Fluxbox and Blackbox are both fairly simple and clean, and each have functional ports available from MacPorts, so you can copy the settings below for Ratpoison and use those if you are interested.

1. Load X11 and XCode development tools from Apple OS X media.

If you want to use xmonad, perform the following steps, or skip to step 6 for Ratpoison. (Leopard only at this point)

2. Download the GHC package for Apple Leopard (same package for Leopard and Snow Leopard at this time)

3. Download the GHC X11 source package (bottom of page)

4. Install the Haskell X11 package:

tar xf X11-1*tar*
cd X11-1*
runhaskell Setup.hs configure
sudo runhaskell Setup.hs build
sudo runhaskell Setup.hs install

5. Install xmonad; pull down the latest source core distribution from the xmonad site

tar xf xmonad-0*tar*
cd xmonad-0*
sudo runhaskell Setup.lhs configure
sudo runhaskell Setup.lhs build
sudo runhaskell Setup.lhs install

If you want to use Ratpoison, perform the following steps, or skip to step 8. (Leopard or Snow Leopard)

6. Install MacPorts using their instructions.

7. Install Ratpoison: sudo port install ratpoison

Combined steps for either window manager.

8. Launch x11, and set a few settings in preferences. On the “Input” tab, ensure that only the following two options are checked:

Emulate three-button mouse
Enable key equivalents under X11

9. Close x11.

10. Pull down awesome X11 fonts from proggyclean. Save them in ~/Desktop/fonts/ or a directory of your choice. Gunzip the PCF files.

11. Open a command prompt and run mkfontdir in the directory to create a fonts dir file.

12. Copy over the stock xinitrc: cp /usr/X11/lib/X11/xinit/xinitrc ~/.xinitrc

13. In ~/.xinitrc, comment out twm, clock, all the xterms, and the if/for loop that runs the stuff in /usr/X11/lib/X11/xinit/xinitrc.d/

14. Append to ~/.xinitc:

/usr/X11/lib/X11/xinit/xinitrc.d/10-fontdir.sh
xset fp+ ~/Desktop/fonts
xset fp rehash
cd
quartz-wm --only-proxy &
if [ -f /usr/local/bin/xmonad ]; then
/usr/local/bin/xmonad &
elif [ -f /opt/local/bin/ratpoison ]; then
/opt/local/bin/ratpoison &
fi
xterm

15. Create ~/.Xmodmap with the following contents:

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
add Mod1 = Meta_L
add Mod2 = Mode_switch

16. Create ~/.Xdefaults with the following contents (adjust the font name if you selected a font other than ProggyTiny with slashed zero):

XTerm*font: -*-proggytinysz-medium-*-*-*-10-*-*-*-*-*-*-*
XTerm*reverseVideo: on
*VT100*reverseVideo: on

17. Launch X11.

Welcome to faster scrolling, paging action, and nice automatic (and fast!) tiling of windows.

A couple of notes:

  • Cut and pasting:
    • within x11 only, you can highlight text and it is on the clipboard
    • to put it on the clipboard for aqua apps, hit command-c as usual with aqua apps
    • to paste within x11 (from either x11 or aqua), just use option-click or middle-click
  • xmonad specific:
    • ctrl-n – new xterm
    • meta-1 through meta-9 will take you through different workspaces in xmonad, which are independent of your built-in virtual desktops in OS X
    • meta-. and meta-, will rotate and redo tiling of windows
  • Ratpoison specific:
    • ctrl-t, s – split vertically
    • ctrl-t, S – split horizontally
    • ctrl-t, tab – moves focus
    • ctrl-t, c – creates new terminal window
    • ctrl-t, ? – help and tips

The only real issue I have with this approach is that I rarely have windows strictly 80 characters wide, so that makes it harder to visually realize when I should be wrapping lines. Luckily nvi(1) and fmt(1) have that covered for me.

Hat tip to Eric Hanson for pushing me in the xmonad direction!

Author: George Lewis

Topic(s): How to,Technical

Published: October 26, 2009 00:05