Skip to content

Instantly share code, notes, and snippets.

@kytta
Created May 6, 2023 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kytta/1424a2c42de384eb92863ec989cf1c44 to your computer and use it in GitHub Desktop.
Save kytta/1424a2c42de384eb92863ec989cf1c44 to your computer and use it in GitHub Desktop.
AppleScript to open a new iTerm2 window (Raycast compatible)
#!/usr/bin/osascript
# This is free and unencumbered software released into the public domain.
# SPDX-License-Identifier: Unlicense OR CC0-1.0
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title New iTerm2 Window
# @raycast.mode silent
# Optional parameters:
# @raycast.icon ⌨️
# @raycast.packageName Developer Utils
# Documentation:
# @raycast.description Opens a new iTerm2 window with default profile
# @raycast.author Nikita Karamov
# @raycast.authorURL https://www.kytta.dev/
if application "iTerm" is not running then
activate application "iTerm"
else
tell application "iTerm"
create window with default profile
activate
end tell
end if
@kytta
Copy link
Author

kytta commented May 6, 2023

Important: Read before you use it

Do not open this script in the Script Editor! On my machine, it saved it in UTF-16 with BOM (little endian), which couldn't be recognized by osascript and couldn't be executed from the command line.

On my machine, this script is a UTF-8 text file with rights to execute (via chmod +x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment