Category Archives: OS X Tools, Tips and Tricks

How to fix mount_fusefs: mount point XXX is itself on a MacFUSE volume errors

If you are getting a mount_fusefs: mount point XXX is itself on a MacFUSE volume when trying to remount an sshfs filesystem in OSX, the fix is pretty straight forward.

  1. type the “mount” command,
  2. find the sshfs#user@host line, and
  3. type the command “umount sshfs….” using the connect string from 2.

This will unmount the server, and make it possible for you to connect again using sshfs.

Making the Home and End Keys work in Eclipse 3.4 on Apple Mac OSX

Hidden in the comments of the article of Starry Hope – Mac Home and End Keys are some instructions for how to make the home and end keys work well as begin and end line in eclipse.  I've done all the other tricks to make this work on my Mac, so was getting really frustrated with Eclipse.  double home and double end are common key combinations for me in IntelliJ and Eclipse on Windows, so the current behaviour of going to the beginning or end of the file drives me crazy.  The details of doing this differ slightly in Eclipse 3.4.1, so I'll list the steps I followed below.

  1. open the eclipse preferences pane
  2. general->keys
  3. in the filter type line start and note that there will be existing bindings when editing text.
  4. select line start type home, and ensure that the "when" field stays with Editing Text
  5. apply
  6. follow this process for select line start, line end, and select line end.

After doing this, expect your anger at eclipse on Mac to decrease to much more manageable levels.

 

Getting php and MySQL up and running on OS X 10.5

Much of the free and open source web technologies in the world runs on Apache, MySQL and PHP. Getting this up and running on your Mac is important to ensure you can do development on the Mac. Once you know the right steps to follow in setting this up, it isn’t too hard, but finding the right information can be a bit tricky.

As at January 15 2009, here is the process that works. If you have problems, let me know and I’ll update this page accordingly.

I’m assuming that you have basic knowledge of how to use a Terminal.

1) Enable php in Apache

Ensure that the php module is loaded. This is done in the httpd.conf, and simply involves uncommenting the LoadModule line. sudo vim /etc/apache2/httpd.conf remove the comment (#) char at the front of the line containing LoadModule php5_module

LoadModule php5_module libexec/apache2/libphp5.so

After doing this you will need to restart apache

sudo apachectl restart

2) Install MySQL

Download MySQL from http://dev.mysql.com/downloads/, and follow the instructions (if you go with the dmg file it’s really easy).

3) Download and Install the MySQL System prefPane

System Preferences is the place to start and stop things in OSX. Many versions exist. The one that actually works with 10.5 is available for download from the MySQL site: ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

4) php.ini

You’ll need to tell php where the MySQL socket lives. To do this take the default php.ini provided, copy it to php.ini, and ensure that the mysql.default_socket and mysqli.default_socket settings both reference /tmp/mysql.sock (that’s for the MySQL and MySQL improved extensions).

sudo cp /etc/php.ini.default /etc/php.ini

sudo vim /etc/php.ini

mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock

After making these changes you’ll need to restart apache.

sudo apachectl restart

5) Install phpMyAdmin

phpMyAdmin is the standard tool for administering MySQL databases. It’s a php client that just works. While you might be able to get away with using a rich client on Mac OSX you should probably use phpMyAdmin because it’s the standard, and running on servers everywhere. Grab a copy from http://www.phpmyadmin.net, read the documentation (there is a quick install guide), and you are off and running.

How Many Keys to Start Composing an Email

 

I was recently reading Rands in Repose Article Saving Seconds, and took the challenge to how many keystrokes would it take for me to start writing an e-mail message.

My first go was a little bit variable.

It consisted of:

  1. a variable number of CMD-tabs to get to Mail.App
  2. CMD-N to create the message.

After reading the true statement that creating e-mail is a common enough task that it should deserve optimisation, I figured that I'd put in the effort to write the AppleScript to optimise it.  So, with the combination of AppleScript, and Butler, I have ended up with:

  1. a single CMD-OPT-CTRL-M to start up Mail.App (I like using CMD-OPT-CTRL for all my Butler shortcuts).

The AppleScript is simply:

tell
    application "Mail"
    activate set newMessage to make new outgoing message with properties {visible:true}
end tell   

 

Finding Large Files on OSX

After a recent security push at ephox (highlighted by a stolen laptop, and then me forgetting that I left my laptop in the office overnight), I've been working on freeing up some space on my laptop so I can turn on FileVault. A quick search of the internet found some great tools for doing this. My weapon of choice was Disk Inventory X. It presents your drive as a tree map, coloured by file type. I was quickly able to find the large files to kill (a couple of 1 GByte hprof files, and some large logs were the guilty parties on my machine).

Disk Inventory X is a good little utility for helping to cleanup up your machine.  If you are ever in need of a tool for OSX to find large files, it is well worth using.

Memory Settings for Eclipse on OSX

For the regular readers of my blog, you may be wondering why I am stepping over to the dark side, and using Eclipse. Not to fear – it is just for an Eclipse plug-in. Using the right tool for the right job is important to always do.

When recently using the SAP Memory Analyzer tool to look at a large (1GByte) hpprof output file, I was running out of Heap space, so was lookin for where to set the -Xmx and -Xms settings on Eclipes. It was somewhat harder to find than desired, and the internet didn’t tell my as quickly as I wanted, so here’s the answer (while the video at http://www.brooksandrus.com/bog_assets/screencasts/eclipsejvmheap/ was cool, a simple text blog entry would have made me happy).

The eclipse.ini file in Eclipse.app/Contents/MacOS is the file that needs to be edited. (not the one that for me was close in location /Applications/eclipse/configuration/ eclipse.ini was bad, /Applications/eclipse/Eclipse.app/Contents/MacOS/ eclipse.ini was good).

After finding the right eclipse.ini, setting the memory is straightfoward. Simpley update the -Xmx and -Xms settings (see: The Sun Tuning java guide for what these do if you don’t know).

OSX RDP Client

I’ve been using the Microsoft RDP client for OSX for a couple of years now.  It is functional, and allows you to easily connect to windows servers, and perform administration tasks on them.  It does have a couple of limitations, the most crushing of which is the lack of an easy way to have two sessions connected at the same time.  As I’m currently working on splitting out a database from an application server, and will be doing heavy development administration of both boxes, this limitation is a killer, so I’ve just done a google to find out my options.

Via the Blogosphere I found coRD (a Cocoa Remote Desktop tool). 

 It is great.  Not only does it solve the problem of being able to connect to two servers at the same time, but it does it in a nice apple look and feel.  Going to my remote desktops doesn’t make me shudder anymore.

The ability to keep all the servers in a single window, and then navigate through them is particularly useful.  I also like the server drawer option.  I’m not a big fan of using a full screen mode to a remote server, but it is available for those who do.  

The only feature from the Microsoft RDP client that I miss is the automatic sharing of my drive.  It made for an easy way to transfer files between the servers.  I can still easily do this through the filesharing options available on the Mac, and I think I actually kinda prefer the more obvious sharing that is done that way.

Overall coRD is a great product, and I would recommend it for Mac users who have windows servers they need to work with.

Forcing the Choice of A Mail Account

I recently posted asking the question of how to force the choice of which account to send e-mail from using Mail.app (Forcing the Choice of A Mail Account). As silence responded to this cry for help, I ended up trying to produce a workaround (credits to AJ for not letting me whinge about this to much and for suggesting I head in this direction). Here is what I ended up with.

Step 1: create a new account in the settings with the name “CHOOSE AN ACCOUNT”. Set the server to localhost, with a simple username and password, which are required. Do this through the preferences screen (CMD-,)

Mail.App Accounts

Step 2: change the composing options to always send mail from the account just created.

Mail.app Composing Preferences

The combination of these two settings will ensure that you are always forced to choose an account when sending a new e-mail message. This already has been a useful opion, stopping me from accidently using the wrong account (which I must admit I did a couple of times beforehand). When you forget you will see the below popup. The important thing to do with this is to choose the “Edit Message” option, and go and choose an account.

Mail.App Cannot Send Dialog

This will produce a working solution, and I've been happy with it, having successfully avoided sending an e-mail from the wrong one of my 4 actively used e-mail accounts.

Manually Removing Items From the OSX Finder Sidebar

[update - as per the comments - in recent 10.6 releases the best way to remove things from the sidebar is to click drag the folder away then push the cmd key before letting go of the mouse]
[update 2 - fixed typo]

The OSX Finder Sidebar is pretty cool.  It lets you have a list of favorite folders that you can easily navigate to.  From time to time one wants to update the list to reflect the current things being worked on.  In a recent cleanup of my sidebar, I had more pain that I wanted to face, but was able to sort out where the preferences are maintained, and wanted to make it easy to work out in the future.

It’s actually pretty straightforward…

~/Library/Preferences is where user preferences are kept. So open up a terminal and type cd ~/Libary/Preferences to get to the preferences directory

Then type  find . -name  *sidebar* in directory, to search for sidebar preferences.  You should see the plist: com.apple.sidebarlists.plist.

Finally type open com.apple.sidebarlists.plist to open up the property list editor, which makes it is easy to then navigate through the tree and remove items.  Finder only loads the properties when it is first started, so you will need to reboot to see the changes take effect.

 

Visio for OS X – OmniGraffle

Abstract

OmniGraffle is a great tool for OSX. You know you want it. If you don’t know, try it out and then you will. If you don’t have a Mac, then buy one, and use OmniGraffle.

Introduction

When architecting a solution for a client, diagrams provide a good way of communication. A picture or diagram(often worth a thousand words), can help communicate concepts and ideas well. In Windows land, the tool of choice for doing these diagrams is Visio. Visio has templates and tools for doing all the standard IT diagrams that an architect needs. Visio is owned by Microsoft, and is a Windows only solution.

What about OS X?

Windows only is bad. I have drunk the koolaid, and do almost all my work on my shiny OSX laptop. Unlike Cedric I am a very happy switcher, and am working out how to get things working the way I want them to.

So when picking up the need to do diagramming, I took a dig around at the options on Mac, and ended up with OmniGraffle. It works great. I’d describe it as a Macified Visio. It has really done a good job of working mac like and has a very good interface. A nice touch is that OmniGraffle supports Visio VXD documents.

Nice features

It really is a nice tool to use. A bunch of the bits that I like are listed below (in no particular order).

The pro version provides canvasing, and layering support. My mental picture is that a canvas is like a printed page. Layers are bits that you can reuse nicely across pages.

I have setup a layer that is the master background. For doing processes it has swim lines set up.

Then the canvases can be used to work on top of the layer. The nice part of this is that the background layer doesn’t get picked up by default when selecting items. I can leave the background there and move around the processes easily.

One can easily select items of the same type using the inspect tool.

There is nice support for grouping items.

When dragging and dropping items around, there are snap points, and guides appearing to help line things up into the right spot, making it easy to give nice vertically and horizontally aligned items.

Magnets on shapes (spots where lines connect to) are able to be changed quickly to any number of different options—and the selection of these is quick and easy.

Templates for all the standard diagrams exist. For the so-inclined there are the standard IT/IS/business process elements, world maps, lego style building blocks, and even CISCO network elements.

Conclusion

In case you didn’t realise, OmniGraffle is good. Go and buy it already.