Last active
January 6, 2026 15:43
-
-
Save rkobylinski/b2fb39832123dbb0e65204b0b142a40d to your computer and use it in GitHub Desktop.
Xcode behavior script to open Claude Code in Terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Xcode Behavior Script: Open Claude Code in Terminal | |
| # Created by Rafał Kobyliński on 06.01.26. | |
| # Handle Swift Package Manager projects | |
| PROJECT_DIR="$(pwd)" | |
| if [[ "$PROJECT_DIR" == */.swiftpm/xcode ]]; then | |
| PROJECT_DIR="${PROJECT_DIR%/.swiftpm/xcode}" | |
| fi | |
| # Get project name (fallback to directory name for Swift Packages) | |
| PROJECT_NAME="${XcodeProject%.xcodeproj}" | |
| if [[ -z "$PROJECT_NAME" ]]; then | |
| PROJECT_NAME="$(basename "$PROJECT_DIR")" | |
| fi | |
| osascript <<EOF | |
| tell application "Terminal" | |
| set targetTitle to "🤖 $PROJECT_NAME" | |
| set foundWindow to false | |
| repeat with w in windows | |
| if custom title of w is targetTitle then | |
| set frontmost of w to true | |
| set foundWindow to true | |
| exit repeat | |
| end if | |
| end repeat | |
| if not foundWindow then | |
| do script "cd \"$PROJECT_DIR\" && CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 claude" | |
| set custom title of front window to targetTitle | |
| set background color of selected tab of front window to {62708, 62451, 61166} | |
| set number of rows of front window to 72 | |
| end if | |
| activate | |
| end tell | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment