Customizing Xcode IDE
Introduction#
This is collection of different tips and tricks, to customize and improve your Xcode IDE
Open Terminal in current Xcode project folder
Xcode have ability to run any script with hotkey.
Here is example how to assign hotkey ⌘+⌥+⌃+⇧+T
to open Terminal app in current project folder.
-
Create bash script and save it in some folder
#!/bin/bash
Project Name: $XcodeProject
Project Dir: $XcodeProjectPath
Workspace Dir: $XcodeWorkspacePath
open -a Terminal ”$(dirname $XcodeProjectPath)”
-
Make script executable: open Terminal at script folder and run
chmod +x your_script_name.sh
-
Open Xcode Preferences at Behaviors tab
-
Add new custom behavior by tapping
+
in the bottom left corner -
Check
Run
action at the right
6. Choose script, which you create previously by clicking at the Choose Script...
twice.
If your script is grayed, be sure, that you run chmod +x
on your script file
7. Assign hotkey (for example ⌘+⌥+⌃+⇧+T
) to your behavior and rename it
Now you can open terminal in project folder with one hotkey.
This is only one example of using Xcode behaviors, but you can create any script and launch any app with it.
Bash script author: https://mattorb.com/xcode-behaviors-for-fun-and-profit/
Clear derived data with hotkey
In the same way as in Open Terminal in current Xcode project folder
example, you can add clear of derived data folder with hotkey.
Create custom behavior (follow the steps in Open Terminal in current Xcode project folder). But use another script.
Script text:
#!/bin/bash
rm -rf $HOME"/Library/Developer/Xcode/DerivedData/"