Posted by JohnnyAppleseed | Under Programming, Review, Software
Thursday May 1, 2008
Do you own, or have access to a remote server that is accessible via the Internet? Do you know how to, and are you able to make an SSH connection to it using Terminal or iTerm? If the answer to those questions is "yes", then I have another one: How would you like to see files and directories on that system appear in Finder on your Mac, just as if your filespace on that system was an external drive sitting next to your computer? This is not only possible, it’s fairly easy, especially once you get past the initial installation of a couple pieces of software.
The installation is a piece of cake, but it does require a system reboot First go to this page at Google Code and download the correct version of MacFUSE for your operating system, and while you are there you can also download the sshfs package:

When you have downloaded the MacFUSE package, double click on it and it will mount the disk image. Inside you should see several items, including a package called MacFUSE Core. Double click on it and it will bring up the MacFuse installer.

Next you will get the opening page of the MacFUSE installer, but first a word from the Apple Nanny:

After you dismiss that irritating screen, you can continue with the installation:

Now, at this point we could show you a few more screenshots, but you really don’t need them - on every screen of the MacFUSE installation, all you have to do is click the obvious choice to continue. There are no options to deal with (well, we suppose you could change the default install location, but that’s probably not a good idea).
Unfortunately, in order to actually USE MacFUSE, you then have to reboot your Mac. Yeah, we hate that too. But once you have rebooted, you can then run the sshfs installer (EDIT: Before you do anything with sshfs, see our article on MacFusion: A BETTER GUI for MacFUSE and sshfs - we think you’ll agree it’s a better interface than sshfs. But if you want to install sshfs just to “get your feet wet” with this technology, that’s fine too, and in any case you should continue reading this article for information on ssh authentication, which is also applicable if you use MacFusion). This is just a normal application disk image so click on it to mount it, click on the license agreement, then drag the application icon into your applications folder in the usual manner. Now, when you want to connect to a remote site, just call up the sshfs application and it will prompt you for the information it needs to make the connection:

Note that after you have clicked on the "Connect" button, you may or may not be prompted for a password. This will depend on whether you have ever set up public and private keys for authentication without the use of a password on your SSH server. Generally, if you can SSH into the server without entering a password, then sshfs shouldn’t prompt you for a password either.
It’s beyond the scope of this article to explain how to set up ssh public/private key authentication, but there are literally thousands of pages indexed by Google that will tell you how to do it - naturally, some pages give better instructions than others. Try doing a Google search on something like "Mac ssh public key." (If you have found a page of instructions that you feel are particularly helpful, please leave the URL in a comment!) EDIT: We have added an article entitled “Stop entering passwords: How to set up ssh public/private key authentication for connections to a remote server” that explains one method of doing this.
Note that there are several options that can be used when setting up ssh public key authentication, and everybody that writes up the instructions seems to have an opinion on which options are the best, or generally speaking, the "correct" way to implement this. If only they all agreed with each other! So if you don’t know enough about it to evaluate the information on those pages, you might be better off sticking with using passwords for the time being - except that passwords are not as secure as key authentication, so maybe it would be a good idea to try and set up the key authentication if you can possibly manage it.
Anyway, once you have sshfs going and the connection made, all you have to do is go into Finder and find the icon for your connected share. If you don’t see it, click on any Finder window, then look at the top menu bar and you should see a selection labeled "Go", which when clicked on produces a drop-down menu:

One of the selections is "Computer" - click on that and it should show you a Finder window with all your mounted drives and shares, including (assuming you have successfully connected) the pseudo-drive that represents your ssh connection to the server. Note that you can drag the icon for this drive into Finder’s left-hand menu (under the devices, not the shared locations), to make it accessible in all Finder windows. This will also give you an "eject" button next to the share name, which if clicked should break the connection to the remote server. A possible alternate way to find the pseudo-drive is to look in the /Volumes directory. In either case, it will bear the name of the system you are connecting to.
Note that simply closing the sshfs application does not seem to break the connection to the server, so once the connection is established you can quit the sshfs app and get its icon out of your your dock area. Also, after you have made the first connection to your server, on subsequent connection attempts you should be able to call up sshfs, cancel the connection dialog, and then in the top menu bar click on "File", then "Recent SSH Servers" and select your server for a quicker reconnection.
If you are using a password, then you will still be prompted for it on each connection attempt. As far as we know, there’s no easy way to automatically establish the remote connection as part of the login process. Note that we said "no easy way", not "no way." We’ve found several techniques for doing it, but all involved the use of such things as shell scripts, Applescript, etc. and really seemed a bit overcomplicated to us. We’re thinking there just might be a way to do it in Automator but haven’t had the opportunity to experiment with that yet. If anyone knows of an elegant method for establishing the connection automatically at login (using entirely free software, of course), please let us know in the comments. Otherwise, if we ever figure out a way to do it, we’ll be sure to do a follow-up post explaining the procedure.
There is one known quirk of this software, and that is that it will always report that you have 1000 GB free on the remote system. Apparently this is something that they’ve been unable to work around. Also, bear in mind that this is not commercial software, so there may be a few other things that don’t work quite as you may expect, but on the whole it works remarkably well.
MacFUSE has other uses besides running sshfs. MacFUSE is the Mac implementation of FUSE, which stands for "Filesystem in Userspace." If you want to know more about FUSE, check out the Wikipedia article. One of the other more popular uses of MacFUSE is to allow use of NTFS-3G, a stable read/write driver that allows both read and write access to drives and devices that have been formatted using the Windows NTFS format (be sure to get the version that works with MacFUSE, and please note that we have not tested this so you may want to read up on it prior to installing it, and only use it if you feel it will reliably meet your needs).
Related posts
Posted by JohnnyAppleseed | Under Crabapple, Hardware, Programming, Review, Software
Friday Apr 25, 2008

photo credit: mac_vegetarianWhen Leopard (Mac OS X 10.5) first came out, one of the greatest new features - and, unfortunately, one of the most frustrating for some users - was Time Machine. Time Machine is probably one of the best pieces of backup software ever written, in that it makes it absurdly easy to retrieve previous versions of accidentally (or purposely) erased or damaged files. But the only problem is that for many users, it has only consistently worked well if you were willing to dedicate a hard drive (or at least a partition) to Time Machine.
Some users have other storage sitting out on their local networks (known as Network-Attached Storage, or NAS), and wondered why they couldn’t use that for their time machine backups. The funny part is that shortly after Time Machine first appeared, a company called Xiotios Software came out with a small program called iTimeMachine which had only one purpose - it enabled the use of AirDisks and Network Disks in Time Machine.

And it worked, until Apple came out with an incremental upgrade to Leopard, which promptly broke the ability to use external disks for backups for many users. Another upgrade, and some users have reported that they can use external drives, while other still cannot.
We think that what iTimeMachine does is the equivalent of opening a terminal window and entering this:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
… which is another method that some folks have used to allow Time Machine to access networked drives. But this alone doesn’t seem to be sufficient in some cases. Today, Mac OS X Hints published an article describing a three-step process to create a Time Machine backup on a network-attached storage (NAS) unit. 
photo credit: Kai HendryUnfortunately, it comes a bit too late for us - earlier this week we bit the bullet and dedicated an external drive to Time Machine, rather than making further attempts to save Time Machine backups to a drive connected to our “Unslung” Linksys NSLU2, which would probably have worked had we had the above information available.
Our “Crabapple of the Week” gets tossed at Apple, for not making Time Machine work well with network-attached storage, or even their own AirDisks, in the first place, and for not yet fully supporting them even as I write this. Of course, those hard cider drinkin’ boys will have already run down to the Apple store to buy a Time Capsule, but for those of us not ready to open our wallets every time Apple comes out with some new (and, dare we say, sometimes overpriced) gadget, information on how to make Time Machine use our existing devices is much appreciated. And another Crabapple goes to Apple for giving out questionable information (this is a quote from Wikipedia’s page on Time Machine):
….. According to Apple, it can only be backed up to network drives if they are being hosted by another computer running Leopard (including Leopard Server). Further, the volume needs to be formatted with the HFS Plus file system, with journaling enabled. External hard drives typically are pre-formatted with the FAT32 filesystem. To use Time Machine, the hard drive must first be formatted, which erases all data. The hard drive will not require formatting if it is already using the HFS filesystem.
Except that for a period of time after Leopard was released, we were making successful Time Machine backups to a drive attached to the aforementioned Linksys NSLU2, which runs a version of Linux, not Leopard. Oh, and the drives were formatted using EXT3 (the format used by the NSLU2) and we did not reformat them, and Time Machine did not erase any data on the drive. So, if the above information from Apple (as reported in Wikipedia) is true now (and we do not believe that the above is entirely true), it’s because Apple changed something during a recent Leopard upgrade. Would Apple deliberately try to make users think they have to purchase a Time Capsule, or at least use a dedicated external drive, even if that’s not strictly true? We won’t speculate further on Apple’s possible motives for spreading questionable information, but we do wish they would just go ahead and fix Time Machine to play nicely with whatever external storage the user may have available.
Related posts
Posted by JohnnyAppleseed | Under Programming, Review, Software
Thursday Apr 24, 2008
If you have any experience on Unix/Linux systems, you may notice that a few essentials seem to be missing on the Mac. In particular, you may find it difficult or impossible to compile programs. Even something as simple as compiling a Perl module cannot be done, unless you first install Xcode, formerly known as the Developer Tools. The following instructions will show you how to install Xcode. Note that the screenshots are from an installation under Mac OS X Leopard but the installation under Tiger should be similar, except you will use a different version of Xcode.
The following instructions show how to install Xcode from the Web, in case you don’t have your OS X installation disk handy. If you are using Leopard, it may be easier to install from the Leopard DVD - if you’d rather do that, insert the DVD and look inside the "Optional Installs" folder. Do NOT click on Optional Installs.mpkg. Hold on while we navigate the web site for those downloading Xcode, and we’ll catch up with you in a moment. If you are using Tiger, there’s a newer version of Xcode on the Apple web site, so you should probably start there instead of using the version on the DVD.
You must first obtain the correct version of Xcode for your version of Mac OS X. To begin, go to this URL:
http://developer.apple.com/tools/download/
This will place you on the downloads page for Xcode. Note that there are different versions available:

Select the version appropriate for your version of OS X. If you are not already logged in you will have to do so… note that an account is free if you don’t already have one:

Next you should be presented with the actual download page. Select the files you want - you don’t actually need the Release Notes but they may come in handy.

Unless you have the sort of broadband connection that makes everyone else envious, go do something else for an hour or two while Xcode downloads. If you are still on dial-up, get a friend with broadband service to download it for you, or just install the version on your install disk.
Got it downloaded? Good! Open the Xcode dmg package you just downloaded. You will see several packages (you folks who are using the version on the DVD can begin following the instructions from here):

The ONLY one you want to use for this install is XcodeTools.mpkg:

Click on that icon to open it up and you will be presented with this screen:

Click Continue for the legal stuff…

Click continue again and and this pops up:

You can read the license (again) if you need to, but you’ll have to click "Agree" to go on. On the next screen, DO NOT CLICK INSTALL unless you want EVERYTHING in the package. If you don’t need everything (and many users don’t), you will save significant hard drive space by being a bit selective here:

Click the CUSTOMIZE button… just to emphasize the point you want to click THIS BUTTON:

That, in turn, will bring up this screen:

The top checkbox (for Developer Tools Essentials) should already be checked (if not then check it). You ALSO want to at the very least check "UNIX Development Support" as shown above (note the names will probably be truncated as shown above). Pick the selections you want, then click INSTALL. Do NOT click "Standard Install" - that’s there in case you want to change your mind and want to install everything. Note that you can always run this again if you decide you really need one of the components you don’t install during this session. After you have clicked on Install, you will have to enter your password:

And once you have done that and clicked OK, should see this screen for quite some time:

Eventually you will (hopefully) see the screen you are waiting for:

And the installation of Xcode is finished! Now you should be able to compile programs or Perl modules using "make" (assuming you know what you are doing!), write programs for the Mac using Objective-C, and so on. This article will not teach you how to do that, but at least we’ve got you started (we hope).
These instructions and graphics were adapted (with permission) from the (recently changed) instructions for the Mac version of a Perl script called CallerIDpop, which polls a Linksys or Sipura VoIP adapter or phone once per second, and when there is an incoming call it pops up a Growl notification on the screen showing caller information (and more). It can also write a log file of calls received on the adapter. If this is of interest to anyone, see this article on the Michigan Telephone, VoIP and Broadband blog which describes the script and offers it for download. The download is fairly large, but that’s because it contains versions of the software (and instructions) for Mac OS X, Windows and Linux.
Related posts
Posted by JohnnyAppleseed | Under Programming, Review, Software
Tuesday Apr 15, 2008
Here at CrabApple Forest we’re always a sucker for free Mac-related things, and we just came across a free e-book that will help you learn to write software for the Mac, should that be your desire.

Quoting from the blog of one of the authors:
Become an Xcoder is a free little eBook we wrote to help beginners with no or little programming experience to start their journey into the world of Mac OS X development with Objective-C and Cocoa. (See Learn Cocoa for a recent discussion on this topic).
I’m glad to announce that the book has been updated for Leopard and Xcode 3, thanks to the work of Alex Clarke (one of the original authors and our publisher at CocoaLab). You can download the PDF of this new edition.
For additional details including more information on where to find related learning materials, see this blog post.
We have the feeling that some people will be able to pick this up fairly easily, while others possibly never will. For those that "just don’t get" Objective-C and Cocoa, there’s always AppleScript and/or Automator workflows, about which we’ll most likely have something to say in upcoming articles. No matter which language you use, we hope you can write some really great software for the Mac!
Related posts