python script to create a desktop icon

  • Open Terminal
  • cd ~/Desktop
  • echo '#!/bin/sh' > run-my-app
  • echo 'cd ~/Desktop/Electron/charityapp' >> run-my-app
  • echo 'npm start' >> run-my-app
  • chmod +x run-my-app

Then just double-click on the icon on the Desktop


Just an addition to the other answer:
if you wouldn't like to see a terminal window opening up each time you double click the bash script file you could create an Automator bundle.

  1. After opening my favorite option are create an application or a service (you can later bind a shortcut to this)
  2. Then select, Library → Utilities and double click on Run Shell Script
  3. From there, in a couple of my previous I used this setting Services recives: no input in: any applications
  4. In the Shell option you can choose /bin/bash instead of the in-script #!/bin/sh and then add the lines of scripts:

    cd ~/Desktop/Electron/charityapp     
    npm start
    

  • You could even choose python script here, but in this case I don't know how to help you.

  • For a shortcut after saving the you-service-name can be seen in System Preferences → Keyboard → Shortcuts → Services.