Articles July 30, 2004 at 1:58 am

Installing Much Needed Developer Tools Remotely

MacTroll has been very good about posting helpful tutorials for the installation of various unix-type tools and plugins for OSX Server. However, many of you might find (as I have) that attempted unix installs sometimes just don’t work (usually with a returned error like "no c-compiler found" or the like). This is because Apple has kindly left out a bunch of unix stuff from the base install, including the all-important gcc compiler for installing/compiling unix software. For those of us lucky enough to have physical access to the problematic server, it’s easy to pop in the Developer Tools CD and install Developer Tools.mpkg by double-clicking. However, I recently found myself needing to install some unix stuff, and had neither Developer Tools nor physical access to the server. So here’s what I did.First, I opened an afp connection to my admin home folder on the server (I did so directly to the box, but going through a VPN would be preferable). I could have ftp’ed the files I needed up, but afp give me an option to send an encrypted password and to tunnel the connection though encrypted ssh (under the "Options…" button after I hit command-k on the keyboard and type afp://myserver.mydomain.mysuffix).

Then, I got the developer tools files, which I didn’t have on my person at the time. I have a membership at developer.apple.com – from there I downloaded the Developer Tools (now known at the developer site as "X Code Tools") via ftp – I used Safari, so I got a mount of the ftp directory on my desktop. The X Code Tools disk image is split up into .bin sections – if you try this, open the one that is not numbered, and the rest will be linked to it automatically by Stuffit Expander. You’ll see the familiar Disk Image Mounter verification notice – don’t skip it – remember that you are building a "virtual" disk image out of about 25 different chunks!

Once the disk image was mounted, I used the duplicate (command-d) command to copy the mounted image to a folder. Then I simply dragged the new folder to the afp share I had mounted. (Note: It would clearly be easier in low-bandwidth situations to download the developer tools via command-line from an ssh session made to the server in question – however, it seems that Apple has only made a download available via a secure web page – so no easy anonymous ftp. If there IS a way to ftp the files from Apple’s servers, let me know!) Fortunately, I had a fast connection.

If I’d had the Developer Tools/Xcode cd with me, I would have packed it up with Disk Utility (compressed) and sent it off – uncompressing it with hdiutil once it got over.

After the transfer was done, a little digging in the man page for "installer" yielded this command string:

[server:~] admin% sudo installer -verbose -pkg DeveloperTools.mpkg -target /

(the "/" is the boot drive of the server – most packages must install to the boot drive – also, happily, the developer tools package does not need a reboot after installation)

The "-verbose" option gives you some nice visual feedback to see how things are going – it’s a very long install, and it’s nice to see a progress indicator.

Also note that you need to do something like "cd Xcode\ Tools" to get into the Xcode Tools directory so that you don’t get a path error. Or you can be a sexxy admin and specify the full path.

Now you are able to install a much wider array of unix programs/plugins/utilities. In my case, I was trying out the Sieve install process that MacTroll had outlined – that install I’m still debugging, but otherwise, everything went very well.

bcirvin/

"Fixing my mistakes, one server at a time"

No Comments

  • After suffering trying to download the dev tools via the intolerably horrible
    Finder FTP I figured out how to do it via the FTP client of my choice.

    When you click the download button on the ADC site with Safari hit
    command-. to stop the transfer as soon as you see the https:// change to an
    ftp:// address. Take a look at the ftp address in the address bar and you will
    see something like: ftp://250612:[email protected]/
    Developer_Tools/xcode_tools_v1.2/7k249_segments/

    From this example I could login to ftp://imercury5.apple.com with the
    username ‘250612’ and a password of ‘16424021’ using the ftp client of my
    choice.

    Happy downloading,
    Josh

    • I believe that is only a temporary address, so if your bandwidth issues prevent
      you from completing your download in an hour, you may have to acquire
      another numeric ID.

      • It is a temp address, but it seems to last for at least a whole session. I’ve been
        logged into it for ~24 hours before. Otherwise how could you ever complete
        the download?

        Plus I wasn’t meaning for anyone to use the example I posted. In fact
        I changed a random number in the user number to prevent it.

        Josh

        • Or you could use the remote control software of your choice to download and
          unstuff the image. Of course that would be cheating. šŸ™‚

          • True enough. However, I’m scared of such tools on client servers. Some
            security experts will warn of the possibility of an attacker rebuilding your
            interface frames from VNC or something like that – anyway, I didn’t have the
            option at the time (plus, ARD and even VNC are so freaking slow compared to
            ssh logins). Anyone want to lobby Apple with me for an X-based display
            option for the Mac OS?

            As far as the ftp option goes – that is indeed good news. I had tried that a
            while back, but the whole imercury server was messed up at the time, so it
            was not a good experience…

            cheers and thanks,
            Blake/ (i’m off to try this right now…)


            Professional Services/Training
            MacOutfitters of Cranberry, PA
            “Fixing my mistakes, one server at a time”

  • An even better way would be to download the Developer Tools directly to the
    remote computer.

    Make an SSH connection to the remote computer. Then on the local computer
    login with Safari to the Apple Developer site, and start to download the tools.

    Once you click on the link to download the tools, the download URL will
    appear in the location field. Stop the download before it starts, copy the URL.

    You can also control click on the the download in the Safari downloads
    window to copy the URL, but you have to wait till the download actually starts
    for that to work.

    Go back to your ssh session to the remote computer, and type:

    curl -O <url on your clipboard>

    (where url on your clipboard is the URL that you copied from the Safari
    download)

    In short order, the developer tools DMG file will be on the remote computer.

    Follow the remaining instructions from the tip to mount, and install the tools.

    Good Luck

    • That method should work fine if you have a logged in user session on the
      remote Mac.

      Remember that the Xcode tools are distributed as a segmented Stuffit file. I
      think that ‘open <first segement>’ would work, but Stuffit will need for a user
      to be logged in to open.

      • Don’t have Deluxe installed right now, but this is interesting:

        <<Command Line Tools – Read Me

        StuffIt Deluxe 8.0 includes two command-line tools, ‘stuff’ and ‘unstuff’. In
        order to use the above tools, it may be necessary to modify the path for your
        environment. The StuffIt Deluxe installer will attempt to do this automatically
        for the install user, but other users will need to do this manually. The path to
        add is:

        /usr/local/bin

        For csh and tcsh users, this can be done by editing the ".login" file in your
        home directory. The following command will add /usr/local/bin to your path
        if needed:

        echo $PATH | grep -q -s "/usr/local/bin"
        if $status == 1 then
        set path = ( "/usr/local/bin" $path )
        endif

        For sh and bash users, this is done by editing the ".profile" file in your home
        directory. The following command will add /usr/local/bin to your path if
        needed:

        echo $PATH | grep -q -s "/usr/local/bin"
        if [$? -eq 1 ] ; then
        PATH=$PATH:/usr/local/bin
        export PATH
        fi
        >>


        Professional Services/Training
        MacOutfitters of Cranberry, PA
        “Fixing my mistakes, one server at a time”

  • I use VNC on my server, but I just ssh in and start the server up when needed.
    When done I close the VNC server back down.

    You can also wrap VNC in SSH or use it over a VPN for security. Joel shows
    how to setup a VPN in his Xserve install article.

Leave a reply

You must be logged in to post a comment.