Posts Tagged ‘macosx’

package of the day

May 30th, 2011 No comments

it has probably bin there from the beginning – i just didn’t know it was there. There’s a nifty little tool, simply called “at”, that can be used to schedule jobs for later execution. So instead of man-paging-together a long command line using shutdown to reboot my machine somewhen late at night i now do:

at 13:37

The job is scheduled for the next point in time possible (that may be the next day if the time specified is already past). Each job gets assigned a number that can be used to delete it with “atrm” and one can list all jobs pending with “atq”.

. . . simplicity at work . . .

Categories: nerdcore, software Tags: , ,

tiling window manager on the mac

January 28th, 2011 6 comments

I recently switched to the awesome (thats the name !!!) wm on my linux box (lets see how long that one will last). So i decided to have dwm up and running again on my mac. Thats rather usefull when working with many terminals at once . . .
First thing is to get the newest XQuartz: – normal X11 produced some wierd key-codes on my site so i switched to XQuartz . . .
Now is the time to get the sources for dwm from and while you’re there grab dmenu as well: Compile and install both somewhere your shell can find them.

Here are the relevant parts of dwm’s config.h:

static const char font[]            = "-*-fixed-medium-r-*-*-15-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[]     = "#cccccc";
static const char normfgcolor[]     = "#000000";
static const char selbordercolor[]  = "#0066ff";
static const char selbgcolor[]      = "#0066ff";
static const char selfgcolor[]      = "#ffffff";
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const Bool showbar           = True;     /* False means no bar */
static const Bool topbar            = True;     /* False means bottom bar */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[]  = { "uxterm", "-font", font, "+cm", "-pc", "-rv", "-sl", "2000", NULL };
	TAGKEYS(                        XK_9,                      8)
	{ MODKEY|ControlMask,           XK_q,      quit,           {0} },

The last line ensures that you do not overlay the quit keycode with the logout-functionality of mac-os-x.

To have dwm start when starting XQuartz create or edit .xinitrc and .Xdefaults in your $HOME. Here’s the actual content of these files on my hardrive

cd ~
exec >>~/.xsession-errors 2>&1
export MANPATH=${MANPATH}:/Users/william/Software/app/dwm/share/man
export PATH=${PATH}:/Users/william/Software/app/dwm/bin
export DATE=`date +"%Y-%m-%d"`
while true
  xsetroot -name "$DATE"
  sleep 3600
done &
#xsetroot -solid '#4a525a'
#xmodmap -e 'remove Mod2 = Meta_L' -e 'add Mod1 = Meta_L'
exec dwm


# File : .Xresources
xterm*font:  -*-fixed-bold-r-*-*-15-*-*-*-*-*-*-*
xterm*font1: -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*
xterm*font2: -*-*-*-*-*-*-2-*-*-*-*-*-*-*
xterm*font3: -misc-fixed-*-r-normal-*-8-*-*-*-*-*-iso8859-*
xterm*font4: -b&h-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*
xterm*font5: -*-screen-bold-r-normal-*-16-*-*-*-*-*-iso8859-*
xterm*font6: -*-lucidatypewriter-medium-*-*-*-18-*-*-*-*-*-*-*
xterm*font7: -*-lucidatypewriter-medium-*-*-*-20-*-*-*-*-*-*-*
xterm*font8: -dec-terminal-bold-r-normal-*-14-*-*-*-*-*-iso8859-*
XTerm*background: black
XTerm*foreground: white
#XTerm*pointerColor: blue
#XTerm*pointerColorBackground: black
#XTerm*cursorColor: navy
#XTerm*internalBorder: 3
XTerm*loginShell: true
XTerm*scrollBar: false
XTerm*scrollKey: true
XTerm*saveLines: 1000
XTerm*multiClickTime: 250

Now dwn should startup when XQuartz ist launched. To make the Alt-keys work you have to switch on the corresponding option under X11->Preferences->Input “Option keys send Alt_L and Alt_R” and I’d also suggest enabling “Emulate three button mouse”.

The key combo shift-alt-enter now starts a new shell. Open a few more. Now you use Alt-j to cycle forward through your shells and Alt-k to cycle backwards. Alt+enter switches the actual shell to the biggest frame on the left. Alt-h and Alt-l move the border between the main shell and the sub-shells by 5% per keystroke.

With alt+number you can switch between the 9 different screens. Using shift-alt-number moves the shell/program with focus to the desired screen.

Starting other apps than the shell is easily done by using dmenu that is started with alt-p. This shows the list of possible target-apps as an overlay to the top-bar. Just type in the first few letters of the app you want to start to refine your selection to the point were you can use the cursor keys to highlight the right name and then press enter to start. You can even use parts of the app-name that are not at the beginning of the word – for example to start xcutsel its sufficient to type in “tsel” :

Rock on 😉

Categories: nerdcore, software Tags: ,

modulecmd on a Mac

January 22nd, 2011 No comments

compiling modules on a mac yields some strange error messages. The trick is to compile without X support. That way only tcl is needed. I use macports so this is what i did:

sudo port install tcl
./configure --with-tcl=/opt/local/lib --with-module-path=/Users/william/Software/mod --with-version-path=/Users/william/Software/app/Modules/ver --prefix=/Users/william/Software/app --without-x

Thats all for now folks – you can go outside and play now 😉

Categories: software Tags:

MacBook Pro SSD tuning

January 21st, 2011 4 comments

As I only use my mac for work/programming/something stuff I chose a SSD (128GB) as storage and upgraded just yesterday from 4 to 8GB of RAM. The following is list of steps I made to maximize IO capabilities and to minimize the SSD usage to prolong its lifetime.

Hint: if something should fail, rebooting into single user mode always works (press command+s during boot). There you can simply rename the RamFS script described below to switch off all changes i describe in the following . . .


Its common knowledge in linux userland that noatime helps to reduce IO as per default on each access of a file the last-access-timestamp has to be renewed. So each read on a file creates a write – noatime (no access time) prevents the write.

Activating that for the disks is done by adding a launchdaemon-script named:


< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
<plist version="1.0">
        <true />

Just to be sure:

sudo chown root:wheel /Library/LaunchDaemons/gpl.selfmade.noatime.plist

After rebooting a “mount” should show that the additional noatime-flag is now active.


The most useful thing to me having 8GB of RAM is working on a RamFS and thus having low latency while developing/compiling (using a local GIT to not loose work on power outage is crucial here). This is what has to be done:

Create a Folder and a file both named RamFS and set access rights accordingly

cd /System/Library/StartupItems
mkdir RamFS
sudo chown -R root:wheel RamFS
sudo chmod -R u+rwX,g+rX,o+rX RamFS
cd RamFS
touch RamFS
sudo chmod u+x,g+x,o+x RamFS

This is my actual version of the RamFS script:

# Create a RAM disk with same perms as mountpoint
RAMDisk() {
    echo "Creating RamFS for $mntpt of size $rdsize 512byte blocks"
    # Create the RAM disk.
    #dev=`hdik -drivekey system-image=yes -nomount ram://$rdsize`
    dev=`hdid -nomount ram://${rdsize}`
    # Successfull creation...
    if [ $? -eq 0 ] ; then
        # Create HFS on the RAM volume.
        newfs_hfs $dev
        # Store permissions from old mount point.
        eval `/usr/bin/stat -s $mntpt`
        # Mount the RAM disk to the target mount point.
        mount -t hfs -o union -o nobrowse $dev $mntpt
        # Restore permissions like they were on old volume.
        chown $st_uid:$st_gid $mntpt
        chmod $st_mode $mntpt
# Test for arguments.
if [ -z $1 ]; then
    echo "Usage: $0 [start|stop|restart] "
    exit 1
# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1 
. /etc/rc.common
StartService () {
    ConsoleMessage "Starting RamFS disks..."
    RAMDisk /private/tmp 4096
#    RAMDisk /var/run 64
#    RAMDisk /var/db 1024
#    mkdir -m 1777 /var/db/mds
StopService () {
    ConsoleMessage "Stopping RamFS disks, nothing will be done here…"
    # diskutil unmount /private/tmp /private/var/run
    # diskutil unmount /private/var/run
RestartService () {
    ConsoleMessage "Restarting RamFS disks, nothing will be done here..."
RunService "$1"

We also need a plist-file called “StartupParameters.plist” in that very folder:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
        <string>RamFS Disks Manager</string>

If you want to use less than 2GB for the ramdisk please switch the dev line to hdik which is the much more lightweight way of mount the ramfs – i want to have a 3-4GB ramdisk which is something hdik cant do do i reverted back to the old hdid.

The flag nobrowse of mount makes sure i dont see the mountpoint in finder and on the desktop while union merges files already in the folder when the ramdisk is created (for deamons that created pidfiles etc earlier in the boot process)

I have a folder called Software in my home were i keep all my (software)projects. The tmp-folder there actually links to the ramdisk at /private/tmp via a softlink. I use that tmp for buildfiles, caching and so on.

If you use macports (as i do) it might also be a good idea to replace
with softlinks to /private/tmp. Keep in mind that your ramdisk must be sufficient to hold the tar.gz, the unpacked sources as well as all the buildfiles for this to work. As an example, the gcc4.4.5 uses around 2.9GB . . .

I also think about moving ~/Library/Caches to the ramdisk, maybe creating an own ramdisk for that purpose.

If you have more ideas let me know in the comments . . .

Categories: software Tags: , ,

keep in-tact,

February 21st, 2009 No comments

I’ve been messing around with different syncing mechanism over the passed days. The goal was to keep my smartphone (Nokia E71 with symbian s60 3rd), two apple notebooks (iBook(OS 10.4) and Powerbook(OS 10.5)) and my pc’s at home and work all running Debian or its derivatives aka Ubuntu in sync.

Fo Mail I use my own IMAP-Server – so theres no problem as all mail is kept in only one place – the mail server

Bookmarks are now synced using the foxmarks tool which works not only for Firefox but also safari (and even IE). I use my own secure webdav folder simply because i trust myself more than the (trustworthy) foxmark people.

Most complicated was to get my addresses, notes and events distributed between evolution under linux with my smartphone running symbian. The solution is Funambol in connection with SyncEvolution on the pc’s. The Nokia E71 has its own “native” synchronization client. For syncevolution there’s also a tray-tool that does timed automatic syncs – genesis.

I will try this setup the following weeks and see if it works well enough for productive use.

Categories: software Tags: , , ,