Saturday, June 22, 2013

MacPorts vs. Tigerbrew

So it's time for another one of those Spy vs. Spy death match posts where I pit two competing software titles against each other, put them through their respective ringers, and conclude with, "Eh, they're both good. It depends on your needs."

Some of you may already have heard of Homebrew. It bills itself as "the missing package manager for OS X" that "installs the stuff you need that Apple didn't." In other words, it enables you to install a lot of Linux tools that aren't otherwise available on OS X. Just like MacPorts, only supposedly simpler and with less headaches. The only glitch is Homebrew has been Intel-only.

This is where Tigerbrew comes in. It's a new fork that runs on PowerPC and Tiger & Leopard. Installation is easy (instructions on the homepage) and it requires Xcode. Now we're ready to put it through its paces.

First, though, let's go back to MacPorts. Initial installation is also easy enough. Just download the installer and run (Xcode required as well). Now in order to test these two package managers out, we need a package to install. The one I have in mind is pianobar. It's a very cool console app for Pandora Radio that I'm stoked to find. Pandora has an official desktop client, but it requires Adobe Air, so screw that. Here's what I get when I install pianobar with MacPorts:

---> Computing dependencies for pianobar
---> Dependencies to be installed: faad2 autoconf m4 perl5 perl5.12 gdbm gettext expat libiconv gperf ncurses xz automake libtool gnutls gmp libtasn1 nettle pkgconfig texinfo json-c libao libgcrypt libgpg-error libmad


As you can see, 25 dependencies. After compiling all that and installing pianobar, it comes to a cool 385 MB of disk space used. Quite a lot.

Here are the dependencies when I install pianobar with Tigerbrew:

Powerbook:~ dan$ brew deps pianobar
faad2
gmp
gnutls
json-c
libao
libgcrypt
libgpg-error
libtasn1
mad
nettle
p11-kit
pkg-config
xz


That's 13 dependencies, and after all the compiling and installing it comes to about 50 MB used. This is where Tigerbrew reveals itself very different from MacPorts. Instead of installing all its own dependencies in /opt/local, independent of your system, Tigerbrew uses OS X's built-in tools, like Python, etc., whenever possible. It also installs everything to your /usr/local.

Does that mean Tigerbrew is superior? Not necessarily. Having a package manager utilize /usr/local has been met with some contention and many people feel MacPorts' way is ultimately better, but with this little demonstration I think we can say Tigerbrew is superior if you're just looking to install a random utility or console app and don't want the massive overhead of MacPorts. MacPorts, on the other hand, may be better if you want to install a ton of packages where the initial overhead would be minimized. There seems to be debate about these issues, though.

Can you use them both side-by-side? Yes, but only if you know what you're doing. You have to be aware of your $PATH and whether you have duplicate tools in /usr/local and /opt/local. Also, when compiling with Tigerbrew, it's probably smart to temporarily move /opt/local to your home folder so there are no conflicts.

A note on pianobar. You can set it to auto-login on startup by creating ~/.config/pianobar/config and adding:

user = youremail
password = yourpassword

along with any other options you want. And there's shell.fm for a console Last.fm client.

pianobar screenshot:

pianobar on OS X

Saturday, June 15, 2013

Mounting Linux Partitions in OS X

So I'm dual booting Tiger and Debian on a Powerbook, and miserly me, I didn't set up an extra sharing partition to transfer files between the two. I didn't want that extra hard drive space to go mostly to waste, so I just decided not to deal with it. So where does that leave me now? I could SFTP to another computer and then back again. I could mount the OS X volume in Linux and read from its ~/Public folder. But what if I'm in OS X and want to mount my Linux partition and copy files over from there? I'm SOL, right? Not so fast.

With the install of a couple of tools, MacFUSE and fuse-ext2, you can mount ext2/ext3/ext4 filesystems in OS X. First caveat: I haven't had the guts to write to my Linux partition from OS X. I'm not sure how stable it is and I had no pressing need to experiment. But feel free to be your own guinea pig! That being said, I've had no problems mounting as read-only and copying files from Linux to OS X. So here's a quick how-to.

After you've installed MacFUSE and fuse-ext2, reboot unless you're one of those smartypants who knows you don't have to. I didn't want to find out if I was wrong, so I wimped out and rebooted. This is already going off on a tangeant. I'm also being distracted by pianobar running on Tiger (more on that later). I'll try to be better.

Anyway, once all that's done, fire up Terminal.app and create a new directory in your /Volumes folder with this command:

mkdir /Volumes/your_folder_name

(UPDATE: For some reason the folder disappears on me after reboot. I can just create it again as needed, but I don't know why it does this.)

I named mine /Volumes/Linux, but you can choose your own. Then you want to find out the identifier of your Linux partition. So run diskutil list and you should see your Linux partition among the output. The right column gives the identifier, in my case disk0s5. Now with that handy info you can mount your Linux partition with:

sudo fuse-ext2 /dev/disk0s5 /Volumes/Linux

Obviously replace disk0s5 and Linux with your own particulars. Only there's a bit of a problem here. In Tiger, and I think this is only an issue in Tiger, when you open /Volumes/Linux in the Finder, the folder disappears. Rather vicious bug, but you can still access it in the Terminal with standard commands like ls, cd, and cp, etc.

Also, the above mount command is read-only. If you want to try read/write and see how that goes, add "-o force" to the command.

Unmounting is a simple sudo umount /Volumes/Linux.

If you want the reverse, say total access to your OS X volume while booted in Linux, that involves a couple of issues. First, it'll be read-only unless you disable journaling in OS X. You also won't have access to OS X's home folder (except ~/Public) due to permissions issues. You can read all about how to get around that here and here. I haven't gotten around to experiencing this firsthand, so I'll farm it out to those links. Have fun!

Sunday, June 2, 2013

Getting a Usable Trackpad on an Aluminum Powerbook in Debian

(UPDATE: In Debian Jessie, my trackpad performs much better.)

I got an aluminum Powerbook off eBay since I decided using a Sawtooth manufactured 13 years ago as my everyday computer was sad, and that a Powerbook from 2006 would be slightly less sad. Actually, all the other choices were even less palpable. Maybe I'll write a post about why decided to stick with PowerPC, but for now I wanted to focus on one thing. After putting Debian on my Linux partition and booting into it, wow did this trackpad suck. Like slow as molasses. And it wasn't a hardware problem. It worked perfectly in OS X. After doing a bit of googling, I found out it's a common problem among Powerbooks from 2005-2006 and the solution is in configuring the synaptics driver.

So here's what you do. First, you should already have the driver, xserver-xorg-input-synaptics, installed as part of the Xorg meta package. Next, you want to open Leafpad or whatever text editor you have and paste the following in a new file:

Section "InputClass"
   Identifier   "Touchpad"
   MatchIsTouchpad   "yes"
   Driver   "synaptics"
   Option   "SHMConfig"              "true"
   Option   "MinSpeed"               "0.3"
   Option   "MaxSpeed"               "1.0"
   Option   "AccelFactor"            "0.25"
   Option   "LeftEdge"               "0"
   Option   "RightEdge"              "950"
   Option   "TopEdge"                "0"
   Option   "BottomEdge"             "645"
   Option   "FingerLow"              "3"
   Option   "FingerHigh"             "7"
   Option   "TapButton1"             "1"
   Option   "TapButton2"             "0"
   Option   "TapButton3"             "0"
   Option   "VertTwoFingerScroll"    "1"
   Option   "HorizTwoFingerScroll"   "0"
   Option   "LockedDrags"            "1"
EndSection

These settings give you left-click tapping, vertical two-finger scrolling, and locked dragging where you have to click again to release the drag. The FingerLow and FingerHigh values are very low to compensate for the initial (non) sensitivity of my trackpad. If this is too sensitive for you, you can up the values to 10 and 30, respectively, or higher. You can also look up man synaptics for all the options and also synclient -l for a list of your defaults.

Next, save the file as synaptics.conf and create a new folder with:

sudo mkdir /etc/X11/xorg.conf.d

Finally, copy the synaptics.conf file into the newly created folder with:

sudo cp /path/to/your/synaptics.conf /etc/X11/xorg.conf.d/synaptics.conf

Now when you restart your X session your new settings should be in effect. In my case it's made for much smoother scrolling, though still not as good as on OS X. Occasionally the trackpad is non-responsive and I have to wake it up with an extra swipe or two.

Another issue specific to these Powerbooks is the keyboard backlight. Via the MintPPC forum, you need to put i2c-dev into /etc/modules and after reboot your keyboard backlight keys should work. Easy.