ssh -CN -L 2025:mail.isp.com:25 -L 2110:mail.isp.com:110 \
myshortname@localhost
Then set Mail.app to use localhost as the SMTP and POP3 servers, and set the ports to 2025 and 2110 respectively. Oh well, for some reason, now it works. Which lead me to try to discover a way of automating the task when my user account logs in.
- I could make a /Library/StartupItem, but that would run even when my user wasn't logged in -- that's not what I want.
- I could make an alias in my shell, then open up the Terminal and type the alias every time -- that's too much work.
- I could create a shell script text file and name it mailtunnel.command and add it to my user account startup items. That's messy because it opens up the Terminal.app and leaves the window open.
- I could have a contextual menu or open a special application that I could use to select a shell command that would trigger the command without Terminal.app opening. That's still too much work. I don't want to have to do anything.
After some searching, I found a fantastic application called Platypus. From their website:
Platypus is a powerful developer tool for creating application wrappers around scripts, i.e. for creating MacOS X applications that execute a bundled script. Scripts can thus be run seamlessly from the graphical window environment, making elegant Mac OS X-native applications from scripts. Here are some of the features Platypus has to offer:So I created a simple shell script:Creating installers, maintenance applications, login items and droplets is very easy using Platypus.
- Supports shell scripts, Perl, Python, PHP, Ruby, Expect, Tcl, AppleScript
- Supports arbitrary interpreter setting -- thus support for any script type
- Executing scripts with root privileges via Apple's Authentication Framework
- Drag and drop files, which are passed to the script as arguments
- Graphical feedback of script execution: progress bar or text window with script output
- Can create applications which run in the background
- Graphical interface for bundling support files with script
- Set own application icon or select from presets
#!/bin/sh
##
# SSH Mail Tunnel Opener
# opens ssh tunnels for smtp (2025) and pop3 (2110)
##
/usr/bin/ssh -CN -L 2110:mail.isp.com:110 -L 2025:mail.isp.com:25 \
myshortname@localhost
Then I used Platypus to create an application with no interface (it can even be a background app which will not show up in the dock -- which Platypus can handle for you), I pointed it to my script, and I had an application I could add to my user startup items with no user interface, no mess, and the process is completely automated.
I'm going to use this program to create all sorts of little apps for stuff I used to have to enter into the command line. Yes, I know I could have used a program like SSH Tunnel manager, but for some reason, I didn't want to go that route.

