• Development

    Applescript to Interact with iTerm2

    iTerm2 has decent support for Applescript. You can work with sessions, profiles, tabs, and more through Applescript. I only have one example, but it’s something I use in the real-world, so maybe it’ll help someone else.

    The following script will open a new tab for every server in the list, and execute a command on that server. Let’s say a new version of Drush is available. I’d use this script to log into every server (we have no less than 15 servers) and check which version of Drush the server is running. I could then quickly update if needed, and I’m already logged in to do so.