4

I would like to make a Python program executable, like in Windows, when you use a program like cx_Freeze to make Python programs become .exe. I would like to do the same for Mac, I would like to make it an app...

I know I can put as first line of the file, a sheebang, or that I can change the mode of the file, but this does not make the program an independent application...

  • 1
    Isn't cx_freeze crossplaform? or use the other apps mentioned on the cx_freeze homepage – user151019 Oct 30 '14 at 17:53
3

You might want to take a look at Platypus. It is a developer tool for OS X that lets you wrap your Python/Perl/shell/etc script with an application framework that makes your Python script appear and run like it was a native OS X application.

Though I believe you can do the same thing with Automator, there are a few extra nice things about Platypus from what I remember. For example, you can create a custom icon for the application where I think Automator's output would probably have to be modified after the fact.

  • Keep in mind, depending upon how you have your system configured, you may need to manually source your shell configuration files within Platypus to ensure environment variables are correct. – tubedogg Oct 30 '14 at 19:24
  • @tubedogg, yes, you do need to be extra careful in your scripts. For example, make sure you're pulling the correct version of Perl/Python/whatever and that any libraries you're expecting are there as well. My experiments with Perl required me to make sure I was hitting the right version based on OS and 32/64bit-ness. If you're going to distribute it, don't assume someone else has same environment variables. Wasn't hard, but worth being mindful about. – bjb Oct 30 '14 at 20:39
2

You can do that with Automator.

  1. Open Automator up
  2. Create a new "Application" document New Automator document
  3. Add a "shell script" action to your workflow Find shell script Drag to workflow
  4. Your shell script should look like this: Shell command
  5. Save it wherever! You can put it in ~/Applications for example.
-1
  1. Open automator
  2. Add a 'run shell' action
  3. There should be a drop down list that says '/bin/bash' click and switch to /usr/bin/python
  4. write your text and your set!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .