Showing posts with label mac os x. Show all posts
Showing posts with label mac os x. Show all posts

2017-10-21

Getting tilde in a Linux VirtualBox guest on Linux via X11 on Mac OS

I only just discovered this. On a Linux server at work (call it "workserver"), I run a VirtualBox VM. When I work on my Mac at home, I launch the XQuartz X11 server, and use VirtualBox on workserver displaying to my Mac.

This is not something I do often, so I had never encountered what I am about to describe until now. In a terminal on the guest, typing the ` key on my Mac gives <.  And typing Shift-` (which is usually ~) gives >.

Oddly, this does not happen with a guest that is running directly on the Mac as the host.

The kluge, which I found at this UK-based blog for surgeons, is to remap the key using xmodmap. (I thought I was done with xmodmap about 10 years ago.)  NB they have a typo: it should be “tilde” rather than “tilda”.  Create the file ~/.xmodmaprc with the following line:

    keycode 94 = grave asciitilda

And then:

    $ xmodmap ~/.xmodmaprc

What I don’t quite understand is the value of the keycode, 94. On the guest, I do:

$ sudo showkey -s

and then type the key I want to see. It emits the code 0x56 on press, and 0xd6 on release. I thought that would be the keycode (after conversion to decimal), but it is not.

My guess is that it is an issue with X11. In XQuartz, I tried the 4 combinations of setting and unsetting these two:

  • Follow system keyboard layout
  • Enable key equivalents under X11
but they did not change the way the grave/tilde key worked, i.e. it still emitted </>.

I also tried setting the keyboard locale:
$ localectl status  System Locale: LANG=en_US.UTF-8      VC Keymap: us     X11 Layout: us      X11 Model: pc105+inet    X11 Options: terminate: ctrl_alt_bksp$ localectl set-keymap us-mac$ localectl status  System Locale: LANG=en_US.UTF-8      VC Keymap: us-mac     X11 Layout: us      X11 Model: pc105+inet    X11 Options: terminate: ctrl_alt_bksp

but that did nothing, either.

2012-06-06

Fink setup for Xcode

And now, for something a little different.

I haven’t used fink and fink packages much, lately, since I now have a work-issue laptop with Linux. I just tried to install octave with fink, and it complained:
Can't resolve dependency "xcode (>= 3.1.2)" for package "gcc47-4.7.0-1001" (no matching packages/versions found)
Even after re-running fink configure, the error persisted. And I did have the latest Xcode installed from the Mac App Store. Turns out, one needs to do:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

That tells fink where Xcode resides.

I have used a Mac since grad school, when Apple introduced Mac OS X, and gave free development tools. So, I used fink to install all the open source software I needed for analysis, after being rendered unable to work several times when my Internet connection went down and my copy of Matlab could not talk to the license server. I even used it for analysis and writing papers in my postdoc.

2011-05-12

Mounting .dmg files in Ubuntu

Every now and then, it may be useful to mount a Mac OS X .dmg (disk image) file in Linux. I just had to do this to get some Canon printer drivers (PPD files) which were distributed in a .dmg file.

There are two steps (not including installing the applicable packages which make reading Apple's HFS+ disk format possible):

  1. convert the .dmg file into a .img file
  2. mount the resulting .img disk image
Before that, install the hfsplus package which allows accessing HFS+ volumes. This will probably install libhfsp0 as a co-requisite. You will also need the dmg2img package to convert the compressed .dmg image format to an uncompressed .img format.

Once you have the appropriate packages installed, do the following (assume the .dmg file is mydisk.dmg):

    $ dmg2img mydisk.dmg
    $ sudo modprobe hfsplus
    $ sudo mkdir /mnt/mydisk
    $ sudo mount -t hfsplus -o loop mydisk.img /mnt/mydisk
    $ cd /mnt/mydisk