Use Nativefier to convert any website/webpage into a desktop application
You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose
Did you know that you can convert any web page into a desktop application from the OS command line interface? In this blog post, I will introduce you to an excellent tool called Nativefier. Nativefier is a command line tool that allows you to create desktop applications for any website with minimal configuration.The desktop application created by electronic (Use Chromium in the background) (In the operating system executable file).app
, .exe
, Etc.) for use on Windows, macOS and Linux.
Native features:
- Automatically retrieve application icon/name.
- JavaScript and CSS injection.
- And more, see API documentation Either
nativefier --help
How to install Nativefier on Linux.Apple system
Then how to install Nativefier on Linux or macOS operating system? The installation requirements are:
- macOS 10.9+ / Windows / Linux
- Node.js
>= 10
And npm>= 6
- Optional dependencies:
- Image magic Conversion icon.make sure
convert
withidentify
In your system$PATH
. - wine Package Windows applications under non-Windows platforms.make sure
wine
In your system$PATH
.
- Image magic Conversion icon.make sure
Install Node.js on Linux/macOS
The first installation requirement is Node.js. Use the following command to install Node.js on Linux or macOS.
### Install Node.js on macOS ###
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install node
### Install Node.js on Ubuntu / Debian ###
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
### Install Node.js on CentOS / Fedora / RHEL ###
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
sudo yum install nodejs
Install Nativefier Apple System on Linux
After installing Node.js, run the following command to install Nativefier globally:
$ npm install -g nativefier
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
/usr/local/bin/nativefier -> /usr/local/lib/node_modules/nativefier/lib/cli.js
> [email protected] postinstall /usr/local/lib/node_modules/nativefier/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
+ [email protected]
added 290 packages from 341 contributors in 75.93s
Use Nativefier to convert any web page into a desktop application
In this example, we will convert computingforgeeks.com Website to desktop application.
$ nativefier "computingforgeeks.com"
URL "computingforgeeks.com" lacks a protocol. Will try to parse it as HTTPS: "https://computingforgeeks.com". Please pass "//computingforgeeks.com" if this is what you meant.
Preparing Electron app...
Converting icons...
Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
Downloading electron-v10.1.0-darwin-x64.zip: [============================================================================================] 100% ETA: 0.0 seconds
Packaging app for platform darwin x64 using electron v10.1.0
Finalizing build...
App built to /Users/jkmutai/Documents/Home ComputingForGeeks-darwin-x64 , move it wherever it makes sense for you and run the app bundle.
You can optionally specify the name of the application you want to create:
nativefier --name 'Computingforgeeks' 'computingforgeeks.com'
Wait for it to complete, and then check the contents of the created folder:
$ ls -1 ~/Documents/Home ComputingForGeeks-darwin-x64
Home ComputingForGeeks.app
LICENSE
LICENSES.chromium.html
version
To understand all available command line flags, use:
$ nativefier --help
Go to the folder to start the application.
Start/install the application generated by Nativefier.
Then you can control the website or web page like a normal desktop application.
Run Nativefier with Docker
If you don’t want to install the Node package, you can choose to run the application as a Docker container.
Pull the latest Docker image:
docker pull jiahaog/nativefier
You can also clone the repository and build the image yourself.
git clone https://github.com/jiahaog/nativefier.git
cd nativefier
docker build -t nativefier .
By default, the command nativefier --help
Will be executed.To build the Gmail native application to a writable local ~/nativefier-apps
,
docker run -v ~/nativefier-apps:/target/ jiahaog/nativefier https://mail.google.com/ /target/
You can pass the Nativefier flag and mount the volume to provide local files. For example, to use icons,
docker run -v ~/my-icons-folder/:/src -v $TARGET-PATH:/target jiahaog/nativefier --icon /src/icon.png --name whatsApp -p linux -a x64 https://web.whatsapp.com/ /target/
label:
- How to convert a web page on Linux into a desktop application
- How to convert a web page on macOS into a desktop application
- How to convert a web page on Windows into a desktop application
- How to convert a website into a desktop application
- How to generate desktop applications from web pages
Linux learning video materials.
Learn Linux in 5 days and improve your career
★★★★★ (24800) $17.69 $188.71 in stock
Udemy.com
Linux Administration Bootcamp: from entry to advanced
★★★★★ (14311) $ 14.15 $ 153.32 in stock
Udemy.com
★★★★☆ (12902) $ 14.15 $ 153.32 in stock
Udemy.com
Linux Proficiency: Master the Linux command line in 11.5 hours
★★★★★ (9868) $ 14.15 $ 153.32 in stock
Udemy.com
You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose