Thursday, February 19, 2009

Display X windows on from another linux box

Sometimes you might want to ssh to a linux box and be able to fire up X applications and see the X windows on your Mac running X11. However, there are some customizations you need to do before everything works.

  1. Fire up (It's located in /Applications/Utilities/
  2. On Mac box: go to X11 preferences and enable "Allow connections from network clients" (Make sure it looks like below)
  3. Restart
  4. Open a terminal in X11 and do: xhost +
  5. ssh to your linux box and do: export DISPLAY=IP_OF_MAC_BOX:0.0

Bingo! On the linux box, you can now run any X app, say xterm and the X window will pop up on your Mac box.

Monday, January 26, 2009

Compiling Valgrind for Mac OS X

I was trying to compile Valgrind (version 3.3.1 r8180, VEX r1854) for Mac OS X as per Greg Parker's instructions.

The make step failed with something like:
gcc -arch i386 -O2 -gstabs -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing -O2 -mmacosx-version-min=10.5 -gstabs -fno-stack-protector -O2 -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -nodefaultlibs -nostartfiles -Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld -arch i386 -mdynamic-no-pic -Wl,-seg1addr,0xf0080000 -Wl,-stack_addr,0xf0080000 -Wl,-stack_size,0x80000 -Wl,-pagezero_size,0xf0000000 -o memcheck-x86-darwin memcheck_x86_darwin-mc_leakcheck.o memcheck_x86_darwin-mc_malloc_wrappers.o memcheck_x86_darwin-mc_main.o memcheck_x86_darwin-mc_translate.o memcheck_x86_darwin-mc_machine.o memcheck_x86_darwin-mc_errors.o ../coregrind/libcoregrind_x86_darwin.a ../VEX/libvex_x86_darwin.a -lgcc ld: in ../VEX/libvex_x86_darwin.a, archive has no table of contents collect2: ld returned 1 exit status make[3]: *** [memcheck-x86-darwin] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2

I was able to fix this with:
$ ranlib VEX/libvex_x86_darwin.a

This needs to be repeated with VEX/libvex_amd64_darwin.a which'll fail the same way. Continuing with make built valgrind successfully for me.

Saturday, March 1, 2008

Select Startup Disk

The most common way to select the startup disk is using the "Startup Disk" preference pane. However, there are times when you want to do this using the command line.

$ sudo bless -mount /Volumes/MY_PARTITION -setBoot

Replace MY_PARTITION with the appropriate volume name, and reboot

Thursday, February 28, 2008

Reformat a disk partition

To reformat a disk partition:

$ diskutil reformat /path/to/device


$ diskutil reformat /Volumes/[mount point]

Friday, August 31, 2007

Which Mac Version?

Here's a quick command to figure out the version of Mac.

sw_vers -productVersion