David Brown’s Blog

David Brown’s Blog

David Brown  //  Software engineer/Jazz musician.

Aug 22 / 3:03pm

NX and MacOS

My primary home machine is a Mac Pro desktop. Although the machine dual boots between MacOS X and Linux, it is rather inconvenient to do so. I have been running Linux in a VM, but find that the performance isn't all that great.

I decided to give No Machine's NX system a try. I decided to give FreeNX a try, mostly because it is GPL, and the source is available. It was fairly easy to install on Gentoo, just:

   sudo emerge nxserver-freenx
and wait a short while.

I downloaded the MacOS NX client from No Machine, since there doesn't appear to be a free version. This client is ppc only, and feels very much like a non-native Mac App. Fortunately, once you are past login, the application comes across as just a single large window.

Unfortuantely, it isn't a native MacOS app, but an X11 app. The first thing I discovered is that the keyboard layout is abysmal. After playing around with 'xev' and 'xmodmap', I came up with the following xmodmap config to make the keys better

keycode 66 = Alt_L
keycode 63 = Super_L
keycode 71 = Super_R
keycode 69 = Alt_R

clear Mod1
clear Mod4
add Mod1 = Alt_L Alt_R
add Mod4 = Super_L Super_R
NX seems to update the keymap on the remote X server to match the current client, so it doesn't seem to be a problem switching between clients.

Although I tell the NX client to make the window the largest size, I still seem to have to click on the green “maximize“ button to make it fill the screen. There's still the Mac menu bar at the top, and a window border below that, and it's be really nice to get full screen to work, but this is quite usable now.

I tried using the connection over a wired LAN, WiFi, as well as an EvDO modem. All of these configurations are quite usable. With the local networks, videos play, although I don't have any audio (the server doesn't have speakers, and I suspect it is going that route).

The last thing I did was to update the keypair used to authenticate the NX ssh login. NX doesn't listen on a port, but uses ssh to connect to the server, always logging in as the 'nx' user. It ships with a keypair that allows the client to connect without any configuration, however, this now relies on the NX password authentication. Fortunately, simply running

sudo nxkeygen
generated a new keypair. I then looked at the file '/var/lib/nxserver/home/.ssh/client.id_dsa.key' and pasted the contents into the keypair in the NX client configuration. This matches my security model better, since I normally don't allow password logins on my machines.

I'll give this setup a try for a while, hopefully it will require me to 'unison' synchronize my data quite as much between so many different machines.

Update: Making clipboard sync work

Getting the clipboard to sync between MacOS and NX was challenging. NX had no problem with the sync, but Apple's X11 doesn't enable it by default.

To set this, completely exit the X11 program, and using a Terminal window, cd to ~/Library/Preferences and 'open org.x.X11.plist. Using the editor, change:


Field Value
enable_key_equivalents false
sync_clipboard_to_pasteboard true
sync_pasteboard true
sync_pasteboard_to_clipboard true
sync_pasteboard_to_primary true
sync_primary_on_select true

It's probably possible to use other settings, but I was able to make this combination work. None of it seems to work if the key equivalents is not disabled, which means you can't use the Apple key shortcuts.

0 comments

Leave a comment...