ChatGPT is my new personal assistant these days. I use it for code, inspiration, chores and much more, constantly cycling between chat.openai.com and sites in other tabs.
Or, I might be working in another app, with no browser open at all. And then, to summon the robot, now I have to open a whole browser and stuff. Ugh.
Just lemme do ⌘ + Space and type “ChatGPT” from the Alfred launch bar already!
What if I could just have ChatGPT running as a standalone Mac app? 🤔
nativefier — a Node.js utility to package any URL into an Electron app, that runs like any ole regular Mac app. Neat!
It works like this:
Boom, you now have an executable
.app ready to open.
Nativefier comes with a ton of build-time options you can use to control how the app should run, once built. Check out the API docs on GitHub.
Build ChatGPT as a standalone app
Please note: The following assumes you already have Node.js installed on your Mac. If not, start by installing from nodejs.org, or with Homebrew.
To build your own ChatGPT.app, here’s what you need to do:
- Install nativefier:
npm install -g nativefier(and, optionally, dependencies as described in the docs)
- Download this Mac app icon I made — it’s a complete
.icnsfile, containing all sizes necessary to look good in any size:
ChatGPT Mac app icon (.icns) (214 KB)
- Move the icon to your Home directory (the folder with your login name)
- Open Terminal.app on your Mac and run the following command:
cd && nativefier --lang "en-US" --darwin-dark-mode-support --name "ChatGPT" --conceal --single-instance --disable-dev-tools --fast-quit --user-agent safari --title-bar-style hidden --icon "chatgpt.icns" https://chat.openai.com/ /Applications/
Breaking it down
(Naturally, I asked the robot to explain this command:)
This command might look intimidating at first, but don’t worry! We’ll break down each option in the command so you can understand what’s happening.
cd: This command changes the current directory to your home directory.
&&: This symbol allows you to chain multiple commands together, executing them one after the other. In this case, the
cdcommand will be executed first, followed by the
nativefier: This is the main command, telling your computer to use Nativefier to create a desktop application.
--lang "en-US": This option sets the language of the application to English (United States). You can replace “en-US” with your preferred language code.
--darwin-dark-mode-support: This option enables dark mode support for the app on macOS (also known as Darwin).
--name "ChatGPT": This option sets the name of the application to “ChatGPT”. You can replace “ChatGPT” with your desired app name.
--conceal: This option conceals the source code of the app, making it harder for others to inspect or modify.
--single-instance: This option ensures that only one instance of the app can run at a time.
--disable-dev-tools: This option disables the developer tools, preventing users from accessing them within the app.
--fast-quit: This option allows the app to quit immediately when closed, without any prompts or delays.
--user-agent safari: This option sets the user agent of the app to Safari, making the website think it’s being accessed from a Safari browser.
--title-bar-style hidden: This option hides the title bar of the app, providing a cleaner appearance.
--icon "chatgpt.icns": This option sets the app’s icon to “chatgpt.icns”. Replace “chatgpt.icns” with the file path of your desired icon.
https://chat.openai.com/: This is the URL of the website you want to turn into a standalone app.
/Applications/: This is the destination folder where your app will be saved. In this case, it will be saved in your Applications folder.
Fix login issue in ChatGPT.app
I ran into a problem early on, testing it all out: When the app first launched, I got stuck at the initial “Please stand by, while we are checking your browser…”-screen. The problem was with the Electron app browser, and how it accesses
OpenAI employs a Cloudflare “captcha” to prevent bots (how meta), and verify legitimate traffic to ChatGPT.
The Cloudflare system seems to not accept the (fake) Google Chrome user-agent string, set by
nativefier by default, when building an app.
To fix this, simply pass a different user-agent string: I used the shortname
safari and it works great. You can see this in the complete command above.
Posting for searchability, in case it helps anyone else! ✌️