Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make a script to open terminal and run .py?

I have a simple python script I can run through terminal. Is there a way to put a shortcut on my mac desktop to open terminal and run like "cd ~/Desktop/script.py"? I have tried automator but i couldn't get it to work

like image 699
Shameer Shahab Avatar asked Feb 03 '26 13:02

Shameer Shahab


1 Answers

Create a file called anyname.command with python ~/Desktop/script.py in it. Then make it executable by running chmod 555 ~/Desktop/anyname.command in terminal. Then when you double-click on anyname.command it should run the python script.

like image 142
Alex Kaiser Avatar answered Feb 06 '26 02:02

Alex Kaiser