Make a file executable in Terminal on Mac (2024)

Make a file executable in Terminal on Mac (1)

Shell scripts must be executable files in order to run. You can use the chmod command to indicate that the text file is executable (that is, its contents can be run as a shell script).

Open Terminal for me

  1. In the Terminal app Make a file executable in Terminal on Mac (2) on your Mac, use the cd command to move into the directory that contains the file you want to make executable. For example:

    % cd YourScriptDirectory

  2. Enter the chmod command. For example:

    % chmod 755 YourScriptName.sh

After making the shell script file executable, you can run it by entering its pathname. For example:

% ~/Documents/Dev/YourScriptName.sh

or

% cd ~/Documents/Dev/ % ./YourScriptName.sh

Helpful?

Thanks for your feedback.

Make a file executable in Terminal on Mac (2024)
Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 5979

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.