Skip to content

Commit 44baa79

Browse files
author
HenkVanHoek
committed
This commit resolves the final build issue for the web application and adds critical documentation for macOS users and developers.
- **web-app.spec:** Adds the missing 'waitress' library to hiddenimports. This fixes a ModuleNotFoundError that occurred when launching the web app on Linux and macOS. - **INSTALL_MACOS.md:** Provides a step-by-step guide for users on how to bypass macOS Gatekeeper security warnings using the xattr command. This is a necessary workaround for running the unsigned application. - **CONTRIBUTING.md:** Adds a corresponding section for developers on how to test their local macOS builds and finalize the release environment.
1 parent 2bf61b3 commit 44baa79

File tree

3 files changed

+61
-43
lines changed

3 files changed

+61
-43
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,15 @@ Before you can run the `finalize` command, you must first use the `create-master
7070
4. Open a **Pull Request** from your branch to the **main** branch of the original repository.
7171
5. Please provide a clear description of the changes you have made in the Pull Request.
7272

73+
## macOS Development
74+
75+
When you build the executables on your Mac using the build.py script, the resulting applications in the dist folder will not be code-signed. The macOS Gatekeeper security feature will prevent them from running correctly.
76+
77+
To test your local builds, you must clear the quarantine attribute after each build. Run the following commands from the root of the project directory in your terminal.
78+
79+
xattr -cr dist/clone-vm
80+
xattr -cr dist/create-master-vm
81+
xattr -cr dist/pi-selfhosting-web
82+
83+
This will allow you to run and test your locally-built executables. The official releases will be signed in the future, but this is the required step for all local development and testing.
7384
Thank you again for your contribution!

INSTALL_MACOS.md

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,74 @@
1-
# Installation and Usage on macOS
1+
# Installing on macOS
22

3-
This guide provides the complete instructions for setting up and using the **pi-server-vm** project on a macOS system.
3+
This guide will walk you through the installation and setup of the Pi-Server-VM tools on a macOS system.
44

5-
---
5+
## Prerequisites
66

7-
## Phase 1: Host System Preparation
7+
Before you begin, please ensure you have the latest version of Oracle VirtualBox installed on your Mac. The Pi-Server-VM tools are designed to manage VirtualBox, so it must be present on your machine.
88

9-
### 1. Install VirtualBox
9+
## Step 1: Download the Latest Release
1010

11-
The project requires the **Oracle VM VirtualBox** application and its command-line tools.
11+
Navigate to the project official releases page to find the latest version.
1212

13-
- **[Download VirtualBox](https://www.virtualbox.org/wiki/Downloads)**
13+
➡️ **[Download the latest release](https://github.com/HenkVanHoek/pi-server-vm/releases/latest)**
1414

15-
Download and run the installer for macOS. During installation, you may be prompted to allow kernel extensions in your **System Settings -> Privacy & Security**. Please approve this for VirtualBox to function correctly.
15+
On the release page, find the "Assets" section and download the file named executables-macOS.tar.gz.
1616

17-
---
17+
## Step 2: Extract the Archive
1818

19-
## Phase 2: Project Setup
19+
1. Open the Terminal application.
20+
2. Navigate to the directory where you saved the downloaded file. For most users, this will be the Downloads directory.
2021

21-
### 1. Download the Release Files
22+
cd ~/Downloads
2223

23-
Go to the [GitHub Releases page](https://github.com/HenkVanHoek/pi-server-vm/releases/latest) for this project.
24+
3. Use the tar command to extract the contents of the archive.
2425

25-
You will need to download **two** types of files for the latest release:
26-
- The virtual machine template, which is a file ending in **.ova**.
27-
- The command-line tools for macOS, which is a file ending in **.tar.gz**.
26+
tar -xzvf executables-macOS.tar.gz
2827

29-
### 2. Extract the Executables
28+
This will create a new directory named dist. Inside the dist directory, you will find a separate folder for each of the tools, for example, clone-vm and create-master-vm.
3029

31-
1. Open the **Terminal** app.
32-
2. Navigate to your **Downloads** folder.
33-
3. Run the **tar** command to extract the archive. The files will already be executable.
30+
## Step 3: Authorize the Applications
3431

35-
tar -xvzf executables-macOS.tar.gz
32+
Because this software is not downloaded from the Mac App Store, a macOS security feature called Gatekeeper will prevent it from running at first. You must perform a one-time action to tell macOS that you trust these tools.
3633

37-
This will create a new folder containing the **create-master-vm** and **clone-vm** tools.
34+
1. Make sure you are still in the same directory in your terminal (for example, the Downloads folder).
35+
2. Run the following commands for each of the tool folders you extracted. This command removes the quarantine attribute that macOS adds to downloaded files.
3836

39-
### 3. Import the Master Template Appliance
37+
For the clone-vm tool:
4038

41-
You must first import the pre-built **.ova** file into VirtualBox.
39+
xattr -cr dist/clone-vm
4240

43-
1. Open the **VirtualBox** application from your **/Applications** folder.
44-
2. Go to the menu **File -> Import Appliance...**
45-
3. Select the **.ova** file you downloaded.
46-
4. On the settings review screen, you can leave all settings as they are and click **Import**. The network adapter will be automatically configured for bridged networking.
41+
For the create-master-vm tool:
4742

48-
---
43+
xattr -cr dist/create-master-vm
4944

50-
## Phase 3: Creating Your First Virtual Pi
45+
For the web-app tool:
5146

52-
You are now ready to create your first clone.
47+
xattr -cr dist/pi-selfhosting-web
5348

54-
1. In your Terminal, navigate into the folder where you extracted the executables.
55-
2. Run the **clone-vm** tool, providing a name for your new VM and any optional parameters.
49+
After running these commands, you will be able to run the executables from inside each folder without any security warnings.
5650

57-
# Example: Create a new VM named 'pi-test-macos'
58-
./clone-vm pi-test-macos
51+
## Step 4: Add Tools to Your System PATH (Recommended)
5952

60-
# Example: Create a more powerful VM and start it immediately
61-
./clone-vm my-powerful-pi --ram 4096 --cpus 4 --start
53+
For convenience, it is highly recommended to add the tool directories to your system PATH. This allows you to run commands like clone-vm from any location in your terminal without having to type the full path.
6254

63-
Your new virtual Pi will be created and will appear in the VirtualBox Manager. After it starts, it will be visible on your local network, ready for use.
55+
1. Move the extracted dist folder to a more permanent location. A common choice is to place it in your home directory.
56+
57+
mv dist ~/pi-server-vm-tools
58+
59+
2. Open the configuration file for your shell in a text editor. On modern macOS versions, the default shell is Zsh, and the file is .zshrc.
60+
61+
nano ~/.zshrc
62+
63+
3. Add the following lines to the very end of the file. This tells your terminal where to find the new executables. Make sure to replace /Users/your-username with the actual path to your home directory.
64+
65+
# Add Pi-Server-VM tools to the system PATH
66+
export PATH="$PATH:/Users/your-username/pi-server-vm-tools/clone-vm"
67+
export PATH="$PATH:/Users/your-username/pi-server-vm-tools/create-master-vm"
68+
export PATH="$PATH:/Users/your-username/pi-server-vm-tools/pi-selfhosting-web"
69+
70+
4. Save the file and close the editor. For the changes to take effect, you can either close and reopen your terminal, or run the following command:
71+
72+
source ~/.zshrc
73+
74+
You can now run the commands clone-vm, create-master-vm, and pi-selfhosting-web directly from your terminal.

web-app.spec

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# web-app.spec (Directory Build Test)
1+
# web-app.spec (Final, Corrected Version)
22
# -*- mode: python ; coding: utf-8 -*-
33

44
from PyInstaller.utils.hooks import collect_dynamic_libs
@@ -8,9 +8,8 @@ block_cipher = None
88
a = Analysis(
99
['webapp/app.py'],
1010
binaries=collect_dynamic_libs('python'),
11-
# This ensures your web templates and static files are included.
12-
# Please verify these paths match your project structure.
1311
datas=[('webapp/templates', 'templates'), ('webapp/static', 'static')],
12+
# This is the crucial line that fixes the ModuleNotFoundError
1413
hiddenimports=['waitress']
1514
)
1615

@@ -20,16 +19,13 @@ exe = EXE(
2019
pyz,
2120
a.scripts,
2221
[],
23-
# This is a best practice for directory builds to avoid duplicating DLLs.
2422
exclude_binaries=True,
2523
name='pi-selfhosting-web',
2624
console=False,
2725
upx=True,
2826
version='file_version_info.txt'
2927
)
3028

31-
# The COLLECT object is what tells PyInstaller to create a final output directory
32-
# instead of a single file.
3329
coll = COLLECT(
3430
exe,
3531
a.binaries,

0 commit comments

Comments
 (0)