Disclaimer: This guide is for creating your own personal Mac application package and is not affiliated with or endorsed by Apple Inc. Apple, Mac, and macOS are trademarks of Apple Inc., registered in the U.S. and other countries and regions. Do not use Apple logos, icons, or other copyrighted artwork in your own app icon or thumbnail unless you have permission.
For this you will require:
- A Mac computer, preferably an Apple Silicon computer rather than an Intel chip.
- Python 3, which you can download from python.org.
Step 1: The Code
For our application we shall use the tkinter library in Python. If you are already proficient at tkinter, you can write your own code.
If you do not know tkinter or are just beginning, you can try this simple code which displays some text:
import tkinter as tk
root = tk.Tk()
root.title("Tkinter Label Example")
root.geometry("300x150") # sets the dimensions of the tkinter window
my_label = tk.Label(root, text="WRITE YOUR TEXT HERE", font=("Arial", 16))
my_label.pack(pady=20)
root.mainloop()
Save the .py file in Downloads as
MacApp.py. The name does not matter, but if you
change it now, you will need to change it in the final Terminal
command too.
Step 2: The Icon
Every app needs an icon. You can design or generate one. It has
to be exactly 1024 x 1024 px. Download it as a PNG and use a tool
like CloudConvert
to convert it to an Apple Icon Image file, which ends in
.icns. Download the .icns file to
Downloads as icon.icns.
Step 3: The App Building
We shall use PyInstaller to convert our Python script into a full-scale app. To install PyInstaller, we first need pip. Open Terminal and run the commands below. If pip is unavailable, use the pip troubleshooting guide.
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip
pip3 might also work instead of pip.
Then run:
pip install pyinstaller
Again, pip3 might also work instead of
pip. For making the Python file into an app, run
these commands:
cd Downloads
pyinstaller --windowed --icon=icon.icns MacApp.py
The command will probably tell you to go to
.../Downloads/dist. When you open that folder in
Finder, you will find a file with the icon you chose. If you
double click it, it will open the tkinter window we just coded.
Step 4: Putting the App with the Other Apps
In Finder, open a new tab and type Shift +
Command + A. This opens Applications.
Go back to the other tab, which has your application, and drag it
into Applications.
Now your app is fully ready and can be used like any other app. It will be present in applications, can be dragged to the dock and is even accessible from spotlight search! It is a true MacOS app.
Making a DMG
When you started setting up your Mac and downloading apps from
online, you probably noticed none of those were
.app files. They were .dmg files.
.dmg means disk image, which basically means
mounting an external drive, like a thumb drive, but a virtual
one, to your computer and dragging the .app to
Applications. This is simpler and faster for users.
If you want to share your app to your friends and family, here is
how to make a .dmg for your app. First, type this
command in the same Terminal where you made the
.app. If you closed the Terminal, you have to do
cd Downloads first.
cd dist
Then type this command:
create-dmg \
--volname "Mac App" \
--window-size 800 400 \
--icon-size 120 \
--icon "MacApp.app" 200 190 \
--app-drop-link 600 190 \
MacApp.dmg \
MacApp.app
If create-dmg is not recognized, then run this
command:
brew install create-dmg
If brew is not recognized, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Also run the commands it asks you to run to add Homebrew to
PATH. These are the commands starting with
echo and eval. Try installing and
using create-dmg now.