Make a Script Executable with chmod +x

Fix 'Permission denied' when running a shell script on macOS by adding the execute permission with chmod.

macOSpermissionsTerminalscriptsLow risk
Run chmod +x backup.sh (in the script's folder) to mark the script executable, then run it with ./backup.sh.

01Command

Command
$ chmod +x backup.sh

02What it does

macOS only runs a script directly if it carries the execute permission bit, and files created by some editors or extracted from archives lose it. chmod +x adds execute for the owner, group, and others; afterwards you can launch the script with ./backup.sh instead of sh backup.sh. Finder's Get Info 'Execute' checkbox edits the same bit but only for the owner, which often isn't enough for scripts that came from the internet.

03Risk

RiskLow risk
!Warning: If the script was downloaded from the internet, read it before running — executable scripts can contain any command, and Gatekeeper does not check plain .sh files.

04Undo

Undo
$ chmod -x backup.sh

05Sources

  • chmod - Change access permissions
    SS64 · technical · 2026-09-17
    Evidence: Documents chmod's syntax 'chmod mode file' and explains modes grant execute permission; the page covers both symbolic and absolute modes.
  • CHMOD(1) - macOS manual page
    Apple (Xcode man pages mirror) · vendor-doc · 2026-09-17
    Evidence: The manual page explains the symbolic mode ugoa with +x adding execute permission for the file.

Last verified: 2026-09-19 · Category: Files & Folders

06Related solutions