Skip to content

Shortcut MacOS

HiroYokoyama edited this page Oct 22, 2025 · 4 revisions

macOS Shortcut Guide

This guide explains how to make a Python app installed with pip install moleditpy runnable as a .app application on macOS and how to set a custom icon.


1. Locate the Binary

The executable file (binary) is typically located at a path like this:

/Users/<username>/Library/Python/<python_version>/bin/moleditpy

2. Create a New Application in Automator

  1. Open Automator
  2. Select "New Document" → "Application"
  3. From the list on the left, add "Utilities" → "Run Shell Script"

3. Configure the Script

Enter the following into the script area:

#!/bin/bash
/Users/<username>/Library/Python/<python_version>/bin/moleditpy "$@"

Note: "$@" is used to pass arguments, such as files that are dragged and dropped onto the app icon.


4. Save as an Application

  1. From the menu, select "File" → "Save"
  2. Name it moleditpy.app
  3. You can temporarily save it to your Desktop or any other location.

5. Move to the Applications Folder

After saving, copy the created app to the system's main Applications folder.

To copy using Finder:

  1. Select moleditpy.app in Finder
  2. Press ⌘ + C to copy
  3. From the Finder menu, click "Go" → "Applications"
  4. Press ⌘ + V to paste

To copy using the Terminal:

sudo cp -R ~/Desktop/moleditpy.app /Applications/

You may be prompted to enter your password when running sudo.


6. Set the Icon

Location of the icon image:

/Users/<username>/Library/Python/<python_version>/lib/python<python_version>/site-packages/moleditpy/assets/icon.png

Steps to set the icon (Copy & Paste method):

  1. Open the icon.png file from the path above in Finder.
  2. With the image open in the "Preview" app:
    • Press ⌘ + A to select all.
    • Press ⌘ + C to copy.
  3. In Finder, select moleditpy.app in the /Applications folder and press ⌘ + I (Get Info).
  4. Click the small icon in the top-left corner (a border will appear) and press ⌘ + V to paste.

This will change the app's icon.

Alternative Method: Convert PNG to ICNS format

# Convert PNG to ICNS
iconutil -c icns /path/to/icon.iconset

# Apply to the app
cp /path/to/icon.icns /Applications/MyTool.app/Contents/Resources/app.icns

Note: iconutil is a standard command on macOS. You can create an icon.iconset directory as follows:

mkdir icon.iconset
cp icon.png icon.iconset/icon_512x512.png
iconutil -c icns icon.iconset

7. Check Execution Permissions (If Necessary)

If the application fails to launch, run the following command:

chmod +x /Users/<username>/Library/Python/<python_version>/bin/moleditpy

8. Done

You can now run the Python app simply by double-clicking moleditpy.app located in your /Applications folder.

Clone this wiki locally