The ramblings of Steve-0Posts RSS Comments RSS

Archive for the Tag 'mac'

Terminal tips for OSX

I’ve been meaning to get around to it for the longest time, but I finally switched over my Mac’s to use bash as the default shell (previously I had it set to tcsh). I’ve become more accustomed to bash the past few years as its the default shell on pretty much any unix/linux nowadays, so it was time to migrate.

The migration itself was pretty easy, but I wanted to gain some of bash’s features, specifically the emac-like keystrokes for moving forward/back a word in the command line, and also to the beginning and end of the line. The keystrokes, among others, are:

ctrl-a Move cursor to beginning of line
ctrl-e Move cursor to end of line
meta-b Move cursor back one word
meta-f Move cursor forward one word
ctrl-w Cut the last word
ctrl-u Cut everything before the cursor
ctrl-k Cut everything after the cursor
ctrl-y Paste the last thing to be cut
ctrl-_ Undo

I’m a big fan of iTerm – I use it as my primary terminal and have been for the last few years, as it matured in terms of performance and has a lot of great features. The most compelling feature it has over the built in OSX Terminal.app, for me, is that you can specify which characters to include when selecting words. A common operation in a terminal is to select a path, i.e. /home/myuser/testfile. In Terminal.app, if you double click on home, it will just select home – so you have to go back, double click on the first “/” character, and mouse right to get the whole word. With iTerm, you can set a preference with characters to include when connecting, i.e. “/”, so when I double click on home in iTerm, it selects the full path. Specifically, in iTerm -> Preferences -> Mouse, i have “Characters considered part of word:” set to /-_.

One thing I couldn’t figure out was how to get the “meta” key in iterm set to the alt/option key on the mac keyboard. Turns out it’s buried in a non-intuitive place, but it can be done. In iTerm, go to Bookmarks->Manage Profiles, and under Keyboard Profiles select Global. On the right side, you need to set Option Key as “+Esc” for this to work – yes, its strange that it has to be Esc instead of Meta, but hey, at least it all works.

No responses yet

Synchronizing multiple iTunes libraries

On and off over the past few years, I’ve looked for a good way to synchronize 2 or more iTunes libraries, and until recently, never found a good solution. The main problem is synchronizing library metadata – syncing files isn’t that difficult, but things like ratings, play counts, etc. is.

My previous solution was simple – I considered one computer my “master”, and simply sync’ed all the files from it to my other computers. Since I do most of my itunes listening (and rating) at work, I used my iMac as the master and my macbook and home desktop were the slaves. This has its downfalls though, as anything I added or rated on my other systems never made its way back to the master system, and I had to make those changes manually.
I decided to search again a few days ago, and found two applications that do exactly what I want:

myTuneSync from SocketHead studios
Syncopation from Sonzea

I checked them both out, and they both work as advertised (both offer free time-limited trials). You install the application, point it at the other itunes library to keep in sync with, and set them up for automatic updates. Syncopation is the clear winner for me, with its cleaner interface, faster performance, and ability to synchronize file deletions as well. Syncopation works only on macs, so if you have a mix of mac and Windows (or only Windows), myTuneSync is for you.

Interestingly, I found these programs two days before the new iTunes 9 was released, and looking at the keynote, I wondered if I just wasted money on something that was now a standard feature of iTunes. (Unfortunately) It turns out that the syncing included with iTunes is limited to purchases from the iTunes store, and doesn’t include anything added by you. It also seems that the metadata does not get transferred over, only the purchased song files.

One response so far

Use iDisk to synchronize IM Chat Logs

Like email, my IM chat logs have become a critical reference and database for me. With both OS X’ spotlight and Adium’s chat transcripts, searching for a conversation in these logs is quite easy. However, not so much so when I’m on my laptop at home, and the chat took place on my work computer. I am looking into services like simkl.com, which act as a proxy and store your chat logs an their servers – but, these don’t have the search interface I’m used to, and I’m not sure I’m ready for yet another company to have access to my personal communications.

So, here’s the procedure I am using to sync my logs using my iDisk included with my MobileMe subscription. It is pretty rudimentary, but works nicely for what I want it to do.

Here are the relevant references I used when putting this process together, as I didn’t feel like spending much time on this:

http://www.macosxhints.com/article.php?story=2008071710372562

http://www.macosxhints.com/article.php?story=20020207214002198&query=dd

http://forums.macosxhints.com/showthread.php?t=2185

http://www.bombich.com/mactips/rsync.html

http://lingon.sourceforge.net/

First, I built the latest rsync based on the link above – not that its really needed, but I figured it wasn’t a bad idea to have the latest, greatest, and most efficient.

Second, you need the actual script, here’s mine, with some names removed:

#!/bin/bash

# Sync all data from Chat logs to MobileMe iDisk

export LOG=/Users/myname/idisk.log
rm -f $LOG
echo `date` > $LOG
echo "Starting copy of Adium Chat History to iDisk..." >> $LOG
export IDISK=/Users/myname/idiskmount
export PWFILE=/Users/myname/bin/idiskpw.txt

cat $PWFILE | mount_webdav -a0 http://idisk.mac.com/dotmacusername/ $IDISK

rsync -a -E -4 -u --exclude=.DS_Store --stats --progress /Users/myname/Library/"Application Support"/"Adium 2.0"/Users/Default/Logs/ ${IDISK}/ChatLog/ >> $LOG
rsync -a -E -4 -u --exclude=.DS_Store --stats --progress ${IDISK}/ChatLog/ /Users/myname/Library/"Application Support"/"Adium 2.0"/Users/Default/Logs/ >> $LOG

umount $IDISK

echo "Backup of Chat Logs to iDisk complete..." >> $LOG
echo "" >> $LOG
echo `date` >> $LOG

exit 0

Now, I created a new job in Lingon to run the sync script. I named it com.myname.idisk.rsync, selected the script I had created (saved in ~/bin), and set it to run every 2 hours. After logging out and back in, everything was up and running. Status can be checked in the log file – after a long initial run, things run very quickly.

You’ll want to repeat this process on any other computer you have for it to work properly. After spotlight reads in all the new files, you should have searchable chat logs on all your macs.

Notes: You’ll need to create the appropriate directories here (idiskmount), and the funky webdav password file. This process is detailed in the macosxhints forum post, it involves typing a few non-std characters in your editor of choice.

2 responses so far

Firefox 3 – Opening a URL in new tab using command-enter

Download/Install UseMetaKeys FireFox Extension

In celebration of the release of Firefox 3 yesterday (and since I had forgotten to install my extension previously), I am posting this quick, dirty, and oh so helpful firefox extension.
Firefox has long been my preferred browser, although for the last year or so Safari had been gaining ground. Firefox 2 was just to bloated and slow, especially on OS X, and Safari was much faster. I always had a hard time choosing between the additional functionality Firefox provides, and the simplicity and speed of Safari. With Firefox 3, that’s pretty much over, and it is back in its place as my primary browser.
However, one thing that has always bugged me about firefox on Mac OS X was that you can’t open a URL in a new tab using Command+Enter, it only works with Option(alt)+Enter. I couldn’t find a fix a year or two ago, and with some quick searching today, I still did not find a good way to reassign the key sequence. So, I looked up a couple howto’s, found a sample/donor project, and whipped up a simple extension with a single purpose – remap Command-Enter to open a url in a new tab (i.e. when typing in the address or search bars). As expected, no support is provided, no warranty intended, etc., but if you’re using Firefox on OS X, I highly suggest installing this.

For some reason, I called it “UseMetaKeys”, and now, a year later, I am too lazy to change the name.

2 responses so far