Out of Hanwell

July 27, 2006

rdesktop on the Mac

Filed under: Uncategorized — Matthias Miller @ 9:30 pm

I used my notebook quite heavily for terminal services, so I was quick to download Microsoft’s Remote Desktop Connection Client for Mac when I got my MacBook. However, it was quite slow even at low color depths. One evening I tried using it to code, but it was very unproductive. After that, I used it mostly to check e-mail. I finally decided to see what it takes to install rdesktop.

Although it took a bit of time to set up, I was very glad I did. It’s very fast and very useable, and it certainly beats Microsoft’s client. I have documented, as best I could, the steps required to set up rdesktop. I apologize in advance for any mistakes. But let me tell you, it’s well worth it!

Getting It Installed

  1. Find and insert your Tiger installation CD.

  2. Using the Finder, locate the Xcode Tools package and install it.

  3. Open the Terminal and run the following command to install X11:

    open /Volumes/Mac\ OS\ X\ Install\ Disc\ 1/System/Installation/Packages/X11User.pkg

  4. Download the latest stable version of rdesktop (1.4.1 at the time of this post).

  5. Assuming you downloaded the package to your desktop, run the following commands in the Terminal:

    cd ~/Desktop
    tar xzf rdesktop-1.4.1.tar.gz
    cd rdesktop-1.4.1
    ./configure && make && sudo make install

    Once that’s done, you can delete the extra files from your desktop.

  6. You should now be able to open X11 from your finder and run rdesktop with the following command:

    /usr/bin/local/rdesktop 192.168.0.255

Fixing the Alt Key

When I first ran rdesktop, I found that the alt/option key did not map as I expected. The solution is simple:

  1. Create a file called ~/.Xmodmap with the following contents:

    clear Mod1
    keycode 66 = Alt_L
    add Mod1 = Alt_L

  2. Open X11 preferences (Cmd+, from X11) and disable “Use the system keyboard layout”.

Streamlining It Further

Although this allowed me to use rdesktop to connect to my computer, it was still too much work, so I decided to streamline the process a bit.

  1. Create a file ~/rdesktop-mycomputer.sh with the following contents:

    #!/bin/sh
    /usr/local/bin/rdesktop -f -a 16 192.168.0.255

  2. Run the following command from the Terminal:

    chmod +x ~/rdesktop-mycomputer.sh

    You should now be able to run open-x11 ~/rdesktop-mycomputer.sh to open rdesktop in X11.

  3. Unfortunately, xterm gets in the way when you want to use full-screen rdesktop. To keep it from launching, run the following command:

    cp /etc/X11/xinit/xinitrc ~/.xinitrc

    Then, using a text editor, open ~/.xinitrc and remove the line that reads “xterm &“.

  4. Finally, open the Finder, Applications, AppleScript, Script Utility and create a new script with the following code:

    do shell script "open-x11 ~/rdesktop.sh &"

    Save the script in the “application” file format in a convenient location, such as your desktop.

  5. You’re done! You should now be able to launch your rdesktop session with a single click!

20 Comments »

  1. Were you able to get this to compile on an Intel Mac? I’m a relative novice at Unix compilation, but it failed on my MacBook, using the latest XCode (2.4). make seems to work, but make install throws a ton of errors…

    -rob.

    Comment by Rob Griffiths [Visitor] — August 24, 2006 @ 4:25 am

  2. Yes, this was on my MacBook. Did you use “sudo make install”? What kinds of errors did you get?

    Comment by Matthias Miller [Member] — August 24, 2006 @ 5:26 am

  3. Thanks!
    I already had X11 and rdesktop working, but I hadn’t figured out the alt-tab problem and hadn’t gotten around to setting up a handy open-x11 shortcut until your example made it so easy.

    As a source for rdesktop, I suggest using fink. Saves the trouble of having to compile it by hand.

    MS’s Remote Desktop Connection is a piece of junk. While I didn’t have performance problems with it, I found that it crashed constantly whenever I tried to use my scroll-wheel.

    Comment by Avi Cherry [Visitor] — September 4, 2006 @ 5:19 pm

  4. Another easy thing to do is create a ~/.profile file with:

    export DISPLAY=:0.0

    so when you use the os x terminal.app program your xwindows apps will open from the command line (x needs to be started of course).

    Comment by Bob [Visitor] — September 8, 2006 @ 6:38 am

  5. Any tips to get clip board mapping to work?

    Comment by Chip [Visitor] — September 29, 2006 @ 5:23 am

  6. I have never had any success with clipboard sharing via rdesktop, either in Linux or Mac, although I would find it helpful at times!

    Comment by Matthias Miller [Member] — September 29, 2006 @ 3:00 pm

  7. I have setup all of the above and am finding rdesktop so much better than the MS incarnation.

    Two points, though. Firstly my cursor is jerky when on the Windows desktop.

    Secondly, to get the Windows desktop to work full screen I had to enable full-screen mode in X11, otherwise the dock and apple menu are visible. This means than when I deisconnect from the rdesktop session I have to do alt/apple A to get out of X11 full-screen mode, then I have to close the X11 session. Is there a neater way to do this? Can anything be added to the rdesktp.sh script to accomplish these things?

    Comment by Phillip Deackes [Visitor] — October 22, 2006 @ 12:51 pm

  8. After researching for a better and faster method for implementing RDP on my Mac Mini, I came across your site. After about 20 minutes of following your instructions, I finally have a successful working rdesktop on my system. I appreciate the time you have taken to put this together.

    -Donovan

    Comment by Donovan [Visitor] — October 23, 2006 @ 7:03 pm

  9. You can use Cmd+Q to close X11. In fact, I don’t always bother disconnecting rdesktop since Cmd+Q will terminate running processes.

    Comment by Matthias Miller [Member] — October 23, 2006 @ 7:04 pm

  10. I was having trouble with the X11 includes (configure script couldn’t find “X”, and xwin.c failed to compile).

    So … I did the following:
    downloaded and installed XCode 2.4. I think I could have installed this using the CDs that came with my iMac, but I didn’t figure that out until later.hacked the configure script, adding /Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include to ac_x_header_dirs

    Then everything just worked. It _is_ must faster than the Microsoft RDP client.

    Comment by Aaron Aston [Visitor] — November 21, 2006 @ 3:29 pm

  11. Have you found a way to get right-click to work without using a two button mouse?

    Comment by Warren Pountain [Visitor] — December 10, 2006 @ 2:42 pm

  12. To right click using a one button mouse in rdesktop is not obvious, but is reliable as long as you do things in the correct order.

    Press down the cmd and control keys.
    Press down the mouse button.
    Release the cmd and control keys.
    Release the mouse button.

    After a while this becomes automatic.

    Comment by Andrew Fletcher [Visitor] — January 11, 2007 @ 5:58 am

  13. Allo!
    Thank for explanation.

    When a try the /usr/bin/local/rdesktop 192.168.0.255 in fink i havea message:
    -bash: /usr/bin/local/rdesktop: No such file or directory

    And if i go to see in this folder, i don’t have such folder.

    Why?

    Comment by Stephane Simard [Visitor] — January 16, 2007 @ 4:05 pm

  14. Stephane,

    if you’ve installed rdesktop via fink you should be able to type

    rdesktop 192.168.0.255

    or even

    /sw/bin/rdesktop 192.168.0.255

    Comment by Brian [Visitor] — January 21, 2007 @ 8:12 pm

  15. Novice here. Could use some help. I have followed your instructions above but get errors running make. Here is a snippet of the errors:

    xwin.c:21:22: error: X11/Xlib.h: No such file or directory
    xwin.c:22:23: error: X11/Xutil.h: No such file or directory
    In file included from xwin.c:29:
    xproto.h:1: error: parse error before ‘*’ token
    xproto.h:2: error: parse error before ‘*’ token
    xproto.h:4: error: parse error before ‘*’ token
    xwin.c:44: error: parse error before ‘*’ token
    xwin.c:44: warning: type defaults to ‘int’ in declaration of ‘g_display’
    xwin.c:44: warning: data definition has no type or storage class


    xwin.c:2527: error: ‘XImage’ undeclared (first use in this function)
    xwin.c:2527: error: ‘image’ undeclared (first use in this function)
    xwin.c:2527: error: invalid operands to binary *
    xwin.c:2527: warning: statement with no effect
    xwin.c:2535: error: ‘ZPixmap’ undeclared (first use in this function)
    xwin.c:2536: warning: implicit declaration of function ‘BitmapPad’
    xwin.c:2536: warning: statement with no effect
    make: *** [xwin.o] Error 1

    I am on an Imac (Intel) running 10.4.8 of mac os X.
    Any advice??

    Thanks,

    Comment by Eric [Visitor] — February 7, 2007 @ 8:59 pm

  16. Ok, I am making some progress. I copied the header files to the right place, so it is finding them now. Here is where I am at:

    make
    gcc -g -O2 -Wall -I/usr/include -DPACKAGE_NAME=\”rdesktop\” -DPACKAGE_TARNAME=\”rdesktop\” -DPACKAGE_VERSION=\”1.4.1\” -DPACKAGE_STRING=\”rdesktop\ 1.4.1\” -DPACKAGE_BUGREPORT=\”\” -DSTDC_HEADERS=1 -DL_ENDIAN=1 -DX_DISPLAY_MISSING=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_FILIO_H=1 -DHAVE_LOCALE_H=1 -DHAVE_LANGINFO_H=1 -DHAVE_ICONV_H=1 -Dssldir=\”/usr\” -DEGD_SOCKET=\”/var/run/egd-pool\” -DHAVE_DIRENT_H=1 -DHAVE_DECL_DIRFD=1 -DHAVE_ICONV=1 -DICONV_CONST=const -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_MOUNT_H=1 -DSTAT_STATVFS=1 -DHAVE_STRUCT_STATVFS_F_NAMEMAX=1 -DKEYMAP_PATH=\”/usr/local/share/rdesktop/keymaps/\” -o xkeymap.o -c xkeymap.c
    xkeymap.c: In function ‘add_to_keymap’:
    xkeymap.c:62: warning: implicit declaration of function ‘XStringToKeysym’
    xkeymap.c: In function ‘xkeymap_init’:
    xkeymap.c:244: warning: implicit declaration of function ‘XDisplayKeycodes’
    xkeymap.c: In function ‘get_ksname’:
    xkeymap.c:479: warning: implicit declaration of function ‘XKeysymToString’
    xkeymap.c:479: warning: assignment makes pointer from integer without a cast
    xkeymap.c: In function ‘read_keyboard_state’:
    xkeymap.c:620: warning: implicit declaration of function ‘XQueryPointer’
    xkeymap.c: In function ‘reset_modifier_keys’:
    xkeymap.c:668: error: ‘XK_ISO_Level3_Shift’ undeclared (first use in this function)
    xkeymap.c:668: error: (Each undeclared identifier is reported only once
    xkeymap.c:668: error: for each function it appears in.)
    make: *** [xkeymap.o] Error 1

    Anyone have any ideas?

    Thanks,
    Eric

    Comment by Eric [Visitor] — February 9, 2007 @ 4:03 pm

  17. Thanks for the ALT key fix. It shows how rarely I use that key because I have been using rdesktop for months without realizing that ALT wasn’t working properly. It was only when I started using ZTreeWin that I noticed the strange ALT behaviour and initially blamed that application.

    Comment by Clinton Forbes [Visitor] — February 11, 2007 @ 8:22 pm

  18. I
    I’m a french canadian, so my keymap are wrong, even i configure rdesktop with “-k fr-ca”

    i have a French Canadian CSA Keyboard.

    How can i fix it?

    If i connect with “MS Remote Desktop Connection” all is ok.

    Thank you!

    Comment by Stephane Simard [Visitor] — March 11, 2007 @ 7:17 pm

  19. [...] rdesktop [...]

    Pingback by Mac OS X Essentials « Out of Hanwell — September 20, 2007 @ 9:54 pm

  20. I am using rdesktop to access my servers and do my windows development from there. however seamlessrdp is kind of a pain with mac and I was wondering if there was a way to make rdesktop embed into my desktop. maybe using the -X switch. I would very much be interested in getting rdesktop to take over my background and be able to use it from there where my mac windows and icons would take presidence and I would be able to minimize or use my second monitor to use windows…. or perhaps a second desktop where I can leave my mac windows open on one desktop and run my windows embedded into my second.

    Thanks in advance.

    Comment by Volure — September 3, 2009 @ 7:57 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.