diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 2946f2706..4e33b67a6 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -88,6 +88,38 @@ jobs: name: msi path: windows-installer/signed/ideasy.msi + - name: Build MacOS PKG + if: runner.os == 'macOS' + shell: bash + run: | + maven_config="$(cat .mvn/maven.config)" + current_version="${maven_config/#*-Drevision=}" + current_version="${current_version/ */}" + cd documentation + mvn -B -ntp clean install + cd .. + mkdir -p macos-installer/pkg-root/bin + mkdir -p macos-installer/Resources + cp documentation/target/generated-docs/IDEasy.pdf macos-installer/pkg-root/ + cp documentation/target/generated-docs/LICENSE.rtf macos-installer/Resources/LICENSE.rtf + cp cli/target/macos-installer/Distribution.xml macos-installer/Distribution.xml + cp -r cli/target/package/* macos-installer/pkg-root/ + cp cli/target/ideasy macos-installer/pkg-root/bin/ + rm -rf macos-installer/pkg-root/system/windows + rm -rf macos-installer/pkg-root/system/linux + chmod +x macos-installer/pkg-root/bin/ideasy + chmod +x macos-installer/scripts/postinstall + cd macos-installer + pkgbuild --root pkg-root --identifier com.devonfw.ideasy --version $current_version --install-location /projects/_ide/tmp/ideasy --scripts scripts IDEasyComponent.pkg + productbuild --distribution Distribution.xml --resources Resources --package-path . ideasy.pkg + # pkgbuild is responsible for building the installation bundle. By using productbuild, we can custimze the installation process, including things like showing a license. + - name: Upload unsigned PKG + if: runner.os == 'macOS' + uses: actions/upload-artifact@v4 + with: + name: pkg + path: macos-installer/ideasy.pkg + # Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to OSSRH Nexus deploy: name: Build Project and Deploy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 935d8733f..859e84aec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -115,6 +115,38 @@ jobs: with: name: msi path: windows-installer/signed/ideasy.msi + - name: Build MacOS PKG + if: runner.os == 'macOS' + shell: bash + run: | + maven_config="$(cat .mvn/maven.config)" + current_version="${maven_config/#*-Drevision=}" + current_version="${current_version/ */}" + next_version="${current_version/-SNAPSHOT/}" + cd documentation + mvn -B -ntp clean install + cd .. + mkdir -p macos-installer/pkg-root/bin + mkdir -p macos-installer/Resources + cp documentation/target/generated-docs/IDEasy.pdf macos-installer/pkg-root/ + cp documentation/target/generated-docs/LICENSE.rtf macos-installer/Resources/LICENSE.rtf + cp cli/target/macos-installer/Distribution.xml macos-installer/Distribution.xml + cp -r cli/target/package/* macos-installer/pkg-root/ + cp cli/target/ideasy macos-installer/pkg-root/bin/ + rm -rf macos-installer/pkg-root/system/windows + rm -rf macos-installer/pkg-root/system/linux + chmod +x macos-installer/pkg-root/bin/ideasy + chmod +x macos-installer/scripts/postinstall + cd macos-installer + pkgbuild --root pkg-root --identifier com.devonfw.ideasy --version $next_version --install-location /projects/_ide/tmp/ideasy --scripts scripts IDEasyComponent.pkg + productbuild --distribution Distribution.xml --resources Resources --package-path . ideasy.pkg + # pkgbuild is responsible for building the installation bundle. By using productbuild, we can custimze the installation process, including things like showing a license. + - name: Upload unsigned PKG + if: runner.os == 'macOS' + uses: actions/upload-artifact@v4 + with: + name: pkg + path: macos-installer/ideasy.pkg # Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to Maven Central. # The version number for the next build will be incremented automatically. @@ -200,6 +232,7 @@ jobs: * Windows: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-windows-x64.tar.gz * Mac(arm64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac-arm64.tar.gz * Mac(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac-x64.tar.gz + * Mac(PKG): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac.pkg * Linux(arm64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-linux-arm64.tar.gz * Linux(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-linux-x64.tar.gz # Changes diff --git a/.gitignore b/.gitignore index c4d866811..86e038b89 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,12 @@ node_modules # generated graphify knowledge graph output (per-developer AI tooling, not shared) graphify-out/ +#macOs installer files +macos-installer/*.pkg +macos-installer/Resources/LICENSE.rtf +macos-installer/pkg-root +macos-installer/Distribution.xml + # Package Files # *.jar *.war diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index e02b585b8..eb6b8a74a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -9,6 +9,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/2039[#2039]: IDE logo not shown in mac task bar * https://github.com/devonfw/IDEasy/issues/2176[#2176]: Support 7z archive extraction * https://github.com/devonfw/IDEasy/issues/2100[#2100]: Fix Python not available for Mac x64 +* https://github.com/devonfw/IDEasy/issues/423[#423]: Added IDEasy installer for macOS. * https://github.com/devonfw/IDEasy/issues/2224[#2224]: Brew upgrade ideasy not working * https://github.com/devonfw/IDEasy/issues/1784[#1784]: GUI now supports displaying progress bars * https://github.com/devonfw/IDEasy/issues/1917[#1917]: Allow the creation of a desktop shortcut for the GUI diff --git a/cli/pom.xml b/cli/pom.xml index 7731a9e05..4ed2d9af3 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -196,6 +196,28 @@ + + Copy Distribution.xml [macOS Installer] + validate + + copy-resources + + + ${project.build.directory}/macos-installer + + $[*] + + + + ../macos-installer/src + true + + Distribution.xml + + + + + diff --git a/documentation/setup.adoc b/documentation/setup.adoc index ca831f81f..41a107154 100644 --- a/documentation/setup.adoc +++ b/documentation/setup.adoc @@ -19,7 +19,7 @@ If you prefer a manual installation feel free to read-one. We try to make it as simple as possible for you. However, there are some minimal prerequisites: -* Unless you use the MSI installer for Windows, you need to have a tool to extract `*.tar.gz` files (`tar` and `gzip`). +* Unless you use the MSI installer for Windows or the PKG installer for MacOS, you need to have a tool to extract `*.tar.gz` files (`tar` and `gzip`). On Windows before Version 10 (1803) use https://www.7-zip.org/[7-zip]. On all other platforms this comes out of the box. * You need to have https://git-scm.com[git]. @@ -36,9 +36,13 @@ The latest release of `IDEasy` can be downloaded from https://github.com/devonfw Extract the contents of the downloaded archive (`ide-cli-*.tar.gz`) to a new folder and run `setup` in this folder (on windows double-click on `setup.bat`). On MacOS please study link:mac-gatekeeper.adoc[Gatekeeper problem and workaround] in order to use IDEasy. +This is also relevant in case of using the PKG installer on MacOS. -On Linux, run `./setup` to install. Your current terminal session will not recognize the `ide` command immediately. To enable it, run `source ~/.bashrc` (or your shell config). -Alternatively, open a new terminal window to load the configuration automatically. For any other existing terminal sessions, you must run the `source` command manually in each. +On Linux, run `./setup` to install. +Your current terminal session will not recognize the `ide` command immediately. +To enable it, run `source ~/.bashrc` (or your shell config). +Alternatively, open a new terminal window to load the configuration automatically. +For any other existing terminal sessions, you must run the `source` command manually in each. Once installed, you want to link:project.adoc[create a project]. As next step read the link:usage.adoc[usage]. @@ -101,9 +105,14 @@ ide upgrade --mode=stable === Downloading SNAPSHOT releases manually -It is also possible to download IDEasy SNAPSHOT releases manually - including for other platforms. This may be useful to verify if SNAPSHOT releases for other platforms include an expected file or not. However, please note that this is a manual process containing multiple steps: +It is also possible to download IDEasy SNAPSHOT releases manually - including for other platforms. +This may be useful to verify if SNAPSHOT releases for other platforms include an expected file or not. +However, please note that this is a manual process containing multiple steps: + +First, identify the latest SNAPSHOT version by going to https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/maven-metadata.xml. +The latest version will be indicated by the `` tag. +For example, if the file would include -First, identify the latest SNAPSHOT version by going to https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/maven-metadata.xml. The latest version will be indicated by the `` tag. For example, if the file would include ``` 2026.04.001-SNAPSHOT ``` @@ -111,17 +120,20 @@ First, identify the latest SNAPSHOT version by going to https://central.sonatype the latest SNAPSHOT version would be `2026.04.001-SNAPSHOT`. Next, we add the latest identified version into the following URL: + ``` https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/${latest_version}/maven-metadata.xml ``` + In our example, the URL would be https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/2026.04.001-SNAPSHOT/maven-metadata.xml. On this page you can find the artifacts of the latest SNAPSHOT release for each platform supported by IDEasy. Lastly, we obtain a download link of the SNAPSHOT version for our desired platform by constructing a final URL: + ``` https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/${latest_version}/ide-cli-${version.value}-${version.classifier}.${version.extension} ``` In our example, if we wanted to download the mac version, the final URL would be https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/2026.04.001-SNAPSHOT/ide-cli-2026.04.001-20260321.030716-2-mac-x64.tar.gz. -From there, we can download the artifact, extract and test it. \ No newline at end of file +From there, we can download the artifact, extract and test it. diff --git a/macos-installer/Resources/CONCLUSION.rtf b/macos-installer/Resources/CONCLUSION.rtf new file mode 100644 index 000000000..8ec4924a6 --- /dev/null +++ b/macos-installer/Resources/CONCLUSION.rtf @@ -0,0 +1,21 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2867 +\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Arial-BoldMT;\f1\fnil\fcharset0 AndaleMono;} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\paperw7920\paperh11520\margl172\margr172\margb172\margt172\vieww11520\viewh8400\viewkind0 +\deftab720 +\pard\pardeftab720\ri0\sa80\partightenfactor0 + +\f0\b\fs24 \cf0 Thank you for using IDEasy.\ +\ +You can create your first project now by typing:\ + +\f1\b0 ide create \ +\ + +\f0\b Or see all available commands by typing:\ + +\f1\b0 ide help\ +\ + +\f0\b If you need more information, take a look at our {\field{\*\fldinst{HYPERLINK "https://github.com/devonfw/IDEasy/blob/main/documentation/setup.adoc"}}{\fldrslt documentation}}.} \ No newline at end of file diff --git a/macos-installer/Resources/background.png b/macos-installer/Resources/background.png new file mode 100644 index 000000000..0519afa5f Binary files /dev/null and b/macos-installer/Resources/background.png differ diff --git a/macos-installer/scripts/postinstall b/macos-installer/scripts/postinstall new file mode 100755 index 000000000..0c3596909 --- /dev/null +++ b/macos-installer/scripts/postinstall @@ -0,0 +1,53 @@ +#!/bin/bash +set -e + +console_user=$(stat -f "%Su" /dev/console) +console_uid=$(id -u "$console_user") + +show_error() { + /bin/launchctl asuser "$console_uid" /usr/bin/osascript \ + -e "display dialog \"$1\" with title \"IDEasy Installer\" buttons {\"OK\"} with icon stop" +} + +echo "Step 1/2: Running IDEasy installation..." + +INSTALL_DIR="$HOME/projects/_ide/tmp/ideasy" + +echo "Installing IDEasy to $INSTALL_DIR" + +LOG_DIR="$HOME/.ide/logs" +mkdir -p "$LOG_DIR" +ts=$(date +"%Y-%m-%d-%H-%M-%S") +LOG_FILE="$LOG_DIR/install-$ts.log" + +echo "IDEasy installation log for this session can be found at: $LOG_FILE" + +if [ ! -d "$INSTALL_DIR" ]; then + echo "ERROR: expected install directory not found: $INSTALL_DIR" >&2 + show_error "IDEasy installation failed: expected directory not found:\n$INSTALL_DIR" + exit 1 +fi + +"$INSTALL_DIR/bin/ideasy" -ftb --no-colors install \ + > "$LOG_FILE" 2>&1 +install_rc=$? + +# 1. Handle generic install errors by analyzing the log file for known error messages +if grep -q "ide (install) failed after" "$LOG_FILE"; then + show_error "IDEasy installation failed. See log:\n$LOG_FILE" + exit 1 +fi + +# 3. Fallback: Exit-Code != 0 and no error message could be detected in the log file. Show generic error message with log file path. +if [ $install_rc -ne 0 ]; then + show_error "IDEasy installation failed (exit code $install_rc). See log:\n$LOG_FILE" + exit 1 +fi + +echo "Step 2/2: Cleaning up temporary ideasy installation..." + +rm -rf "$INSTALL_DIR" + +echo "Install finished" + +exit 0 diff --git a/macos-installer/src/Distribution.xml b/macos-installer/src/Distribution.xml new file mode 100644 index 000000000..963d5118a --- /dev/null +++ b/macos-installer/src/Distribution.xml @@ -0,0 +1,23 @@ + + + + IDEasy - $[project.version] + + + + + + + + + + + + + + + + IDEasyComponent.pkg + diff --git a/pom.xml b/pom.xml index 2818af05a..88d230703 100644 --- a/pom.xml +++ b/pom.xml @@ -287,6 +287,26 @@ error + + + + org.apache.maven.plugins + maven-clean-plugin + 3.5.0 + + + + ${basedir}/macos-installer + + Distribution.xml + *.pkg + pkg-root/ + + false + + + +