Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Executable on SaveNew to Visual Studio Code? Get it now.
Executable on Save

Executable on Save

jimeh

|
5 installs
| (0) | Free
Make files executable (chmod +x) on save if they start with "#!"
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info
Logo

Executable on Save

VSCode extension that automatically makes script files executable on save.

VSCode OpenVSX Latest Release GitHub Issues GitHub Pull Requests License

What It Does

When you save a file that starts with #! (a shebang), this extension automatically makes it executable (similar to chmod +x). No more manually making your shell scripts, Python scripts, or other executable files runnable.

Installation

Install from the VSCode Marketplace, OpenVSX, or via the command line:

code --install-extension jimeh.executable-on-save

How It Works

The extension watches for file saves. When a file is saved:

  1. Checks if the first two characters are #!
  2. Checks if the file is already executable
  3. If not executable, applies the appropriate permissions

Behavior Notes

  • Only processes files with file:// URIs (ignores untitled documents)
  • Shows a small notice when file permissions are modified
  • Skips files that are already executable
  • Runs after every save, minimal performance impact

Configuration

Enable/Disable

Control whether the extension runs when saving a file:

{
  "markExecutableOnSave.enabled": true
}

Default: true

Permission Strategy

Choose how the execute permissions are added:

{
  "markExecutableOnSave.permissionStrategy": "umask"
}

Options:

  • "umask" (default): Respects system umask when adding execute
  • "read-based": Adds execute only where read permission exists
  • "all": Adds execute for user, group, and other unconditionally

Umask Strategy (Recommended)

Respects your system's umask setting, following Unix conventions. Only adds execute permissions that would be allowed on newly created files.

With umask 0o022 (typical):

Before After Description
rw-r--r-- rwxr-xr-x All get execute
rw------- rwx--x--x All get execute
rw-rw-r-- rwxrwxr-x All get execute

With umask 0o077 (restrictive):

Before After Description
rw-r--r-- rwxr--r-- Only user gets execute
rw------- rwx------ Only user gets execute
rw-rw-r-- rwxrw-r-- Only user gets execute

Technical: Calculates default file permissions (0o777 & ~umask), extracts execute bits, and applies them via bitwise OR.

Safe Strategy

Maintains permission symmetry by only adding execute where read exists:

Before After Description
rw-r--r-- rwxr-xr-x Standard file permissions
rw------- rwx------ Private file stays private
rw-r----- rwxr-x--- Group-readable becomes group-executable

Technical: shifts read bits right by 2 positions to derive execute bits.

Standard Strategy

Always adds execute for all three permission groups:

Before After Description
rw-r--r-- rwxr-xr-x Standard file permissions
rw------- rwx--x--x Others gain execute access
rw-r----- rwxr-x--x Others gain execute access

Technical: performs bitwise OR with 0o111.

Silent Mode

Disable information popups when permissions change:

{
  "markExecutableOnSave.silent": false
}

Set to true to suppress notifications altogether.

Manual Command

"Make Executable If Script"

Checks for shebang and applies permissions manually, respecting the configured strategy.

Platform Support

  • macOS: Full support
  • Linux: Full support
  • BSD: Full support
  • Windows: Disabled (Windows uses different permission model)

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft