April 17, 2014

Toggle display of hidden files in Finder with Automator (OSX)

Do you find yourself needing to toggle the display of hidden files in Mac OSX?  Yeah, me too.   For us web developers this can often be to edit .htaccess files.

For reference here is the code:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Don’t get me wrong, playing in Terminal is sublime geekiness but still something I wish was easier.  Say, with a keyboard command or mouse click.

This is where Automator comes in.  Automator is a way in OSX to, as you might guess, automate tasks.

User madgunde over at Art of Geek put together a great article on how to create an Automator script to add a services menu option for all Finder windows.  This makes is very convenient to with just a click to switch the display of hidden files.  And it is more graceful than using the KillAll Terminal command.

Head over to Art of Geek for the full article.

Making the most out of Dropbox with symlinks

Dropbox is great.  It is a folder where you can drop your files and have them sync into the cloud securely and sync them with any computers you want.

I primarily use this for syncing my MacOS keychains between my Mac Pro and Macbook Pro.   This in combination with MobileMe ensures that almost everything is kept in sync between computers.

While I do use Back to my Mac to access my files on the Mac Pro while I am away, I have found it to be somewhat unreliable.  For no reason it will periodically become unavailable and will show an error that it cannot map the correct port.  This is odd because there are no other machines that should use that port (4500) on the network (I will go over port mapping and IP reservations in another post).

With that in mind and other potential issues which could cause my Mac Pro to be unavailable I set out to see if I could further leverage Dropbox.  So not only did I want to sync my preferences and passwords, but project files as well.  It probably isn’t feasible for me to back up everything but current projects should do.

I have my projects folder located on the same drive as my Dropbox folder, which is 2 500gig drives in a software RAID mirror for redundancy (and my entire system is backed up to a Drobo).  My folder structure was established prior to getting Dropbox and I sure don’t want to move things around now… plus that would mean that I would far exceed what my Dropbox account can handle.

In comes symlinks (or Symbolic Links).  Symlinks are much like Mac OS aliases with a few key differences.  For instance, if you move the folder the symlink points to, your symlink will no longer work properly.  And while symlinks are compatible with pretty much any UNIX operating system they don’t play nice with Classic (don’t know that this is really a problem for anyone these days).   For our purposes symlinks are a perfect way to maintain our existing file structure and leverage Dropbox in the process.

You could fire up Terminal and create symlinks the old fashioned way (more info here)…. or you could do what I did and install SymbolicLinker. SymbolicLinker provides a nice system-wide way of quickly creating symbolic links via the context-menu in OSX.

Screen shot 2009-11-17 at 8.46.52 AM

Just right-click (or control-click) the folder (works best with folders not individual files) then hit the option to create a symbolic link.  This works and looks just like an alias in OSX.  Just copy this over to your Dropbox folder and you are good to go!

Clean up Finder’s “Open With” menu

Recently VLC started showing up twice in my “Open With” menu in OSX Snow Leopard.  In fact one of the links didn’t even work so I wanted to clean it up.

This of course wouldn’t just apply to VLC, other apps can cause it as well.  This list is built over time based upon the programs you open.  A duplicate on this list might just reference an old version of a program.

Just open up your hard drive open your USER/Library/Preferences and delete the file”com.apple.LaunchServices”.  Not to worry, this won’t hurt anything.  But if you are feeling nervous just back up the file somewhere.

Once you have trashed it, check out your menu, things should be reset.