Shell scripts are text that can also contain commands. Setting VS Code as the default makes double-clicking an editing workflow; it does not grant execute permission or choose your terminal shell.
Method 1: Use Finder
- In Finder, select a sample file such as setup.sh.
- Press Command–I, or choose File → Get Info.
- Expand Open with and choose Visual Studio Code. If it is missing, choose Other and locate the installed app.
- Click Change All and confirm the macOS prompt.
- Double-click another file of the same type to check the new default.
Method 2: Manage associations with Pahkui
Pahkui lets you browse by app or by format. When setting up an editor for several file types, you can inspect the current defaults and review pending changes in one window. Requires macOS 14 or later.
- Open Pahkui, switch to Format, and search for the extension you need from .sh, .bash, .zsh.
- Select Visual Studio Code. Use Choose another app if it is not listed.
- Review the pending association, click Apply changes, and confirm the new app in the macOS dialog.
The formats in this guide require Pahkui Pro, a one-time purchase for lifetime use. The manual Finder method does not require a purchase. See pricing

If the default app does not change
- Review a script before running it. To execute it, use an intentional terminal command after checking its contents.
- Check .bash and .zsh separately, and remember that extensionless shell startup files are not covered by a .sh association.
- If Visual Studio Code is missing, confirm it is installed and can open the sample directly, then locate it with Other. If an extension is absent from the catalog, add the format in Pahkui. Changing an association does not add format support to the target app.
Common questions
Does this change the default terminal?
No. The terminal app, login shell, executable permissions and file opener are separate settings.
How do I restore the previous app for .sh, .bash, .zsh?
Choose the previous app again in Finder or Pahkui and confirm the change. This updates the type association without deleting files. Use the Open With context menu for a one-time exception.