Skip to content

#798: fixed pgAdmin macOS dmg installation - #2018

Open
shodiBoy1 wants to merge 22 commits into
devonfw:mainfrom
shodiBoy1:feature/798-878-pgadmin-macos
Open

shodiBoy1 wants to merge 22 commits into
devonfw:mainfrom
shodiBoy1:feature/798-878-pgadmin-macos

Conversation

@shodiBoy1

@shodiBoy1 shodiBoy1 commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes #798 and #878

Implemented changes:

  • Added common macOS DMG installation support for global tools. Downloaded DMG files are extracted instead of being executed, and the contained application bundle is moved to /Applications.
  • Reused the existing DMG extraction logic and preserved symbolic links inside macOS application bundles.
  • Ensured that mounted DMG files are detached during cleanup, including when copying the application fails.
  • Reused the privileged-command logging introduced for Log command before asking user for sudo password #415 so each sudo command is shown before it runs and before the password prompt.
  • Reused #2252 getMacApplicationName() / findMacApplicationBundle() to detect an already installed Mac app. If Contents/MacOS/ contains the tool binary, that folder is added to PATH.
  • Used the correct pgAdmin executable name for each operating system: pgAdmin 4 on macOS and pgadmin4 on Linux and Windows.
  • Added tests for DMG installation, macOS application detection, symbolic link preservation, and OS-specific pgAdmin executable names.

Testing instructions

Check out the PR:

  gh pr checkout 2018

Automated tests (any OS)

  mvn -pl cli -Dtest=FileAccessImplTest,GlobalToolCommandletTest,PgAdminTest test

Manual test (macOS)

The install copies the app to /Applications with sudo, so it has to run in a real terminal (the IntelliJ Run console can't enter a sudo password).

  1. Build the CLI and generate its classpath from the IDEasy repo:
  mvn -q -pl cli -DskipTests compile dependency:build-classpath -Dmdep.outputFile=/tmp/ide-cp.txt
  1. Run pgadmin from a terminal (adjust the two paths to your machine: where you cloned IDEasy, and your IDE test project / IDE_ROOT):
  cd ~/projects/text-fix
  IDE_ROOT=~/projects java -cp "$HOME/IdeaProjects/IDEasy/cli/target/classes:$(cat /tmp/ide-cp.txt)" com.devonfw.tools.ide.cli.Ideasy pgadmin

You should see it download the dmg, print the privileged commands, ask for your password, copy pgAdmin 4.app into /Applications, and start pgAdmin.

  1. Run the same command again it should detect pgAdmin in /Applications, skip the install (no password prompt), and just launch it.

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jun 12, 2026
@shodiBoy1 shodiBoy1 self-assigned this Jun 12, 2026
@shodiBoy1 shodiBoy1 added macOS specific for Apple MacOS pgadmin postgres admin UI integration labels Jun 12, 2026
@coveralls

coveralls commented Jun 12, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 37221202593

Coverage increased (+0.1%) to 74.25%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 281 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

281 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/io/FileAccessImpl.java 188 72.1%
com/devonfw/tools/ide/tool/GlobalToolCommandlet.java 57 43.67%
com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java 18 18.42%
com/devonfw/tools/ide/context/IdeContext.java 17 76.92%
com/devonfw/tools/ide/version/VersionSegment.java 1 90.81%

Coverage Stats

Coverage Status
Relevant Lines: 19615
Covered Lines: 15230
Line Coverage: 77.64%
Relevant Branches: 8711
Covered Branches: 5802
Branch Coverage: 66.61%
Branches in Coverage %: Yes
Coverage Strength: 3.33 hits per line

💛 - Coveralls

@shodiBoy1
shodiBoy1 marked this pull request as ready for review June 13, 2026 14:44
@shodiBoy1 shodiBoy1 moved this from 🆕 New to Team Review in IDEasy board Jun 13, 2026

@hohwille hohwille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shodiBoy1 thanks for analysing and fixing this bug.
The code looks quite redundant to already existing code (e.g. to "extract dmg", the installation routine or to prompt when running privileged operations). I got the impression that we need to understand the root cause properly and fix the bug trying to avoid the copy&paste. I hope we will soon meet in a daily or otherwise to clarify this.

@shodiBoy1

Copy link
Copy Markdown
Contributor Author

Thanks for the review, i reworked it to fix the root cause and reused existing code instead of copying it.

  • Now it calls existing extractDmg. I only fixed method that copy the .app with ditto, because old recursive copy crashed on the framework symlinks inside pgAdmin 4.app.

  • .dmg case is just one branch in the existing doInstall.

  • also reused Log command before asking user for sudo password #415 logging (pulled logPackageManagerCommands into a shared logPrivilegedCommands).

Tested on Mac (arm64):

  • pgadmin: fresh install copies the app to /Applications and starts it; running again detects it as already installed.
  • android-studio: uses the same extractDmg, still installs fine and the dmg unmounts cleanly.
  • docker: still works, no change for an already installed Docker (detected on PATH). Since Rancher also downloads a .dmg on Mac, a fresh install now goes through the same fixed path.

@OscarVertonix

Copy link
Copy Markdown

I can confirm, that the automatic test as well as the manuel test are working as described. I was able to install and launch pgAdmin without problems. Although ide uninstall pgadmin fails with the following message:

Couldn't uninstall pgadmin because we could not find an installation

In case, this behavior isn't correct, a new ticket should be created. If this is correct, because we don't want to uninstall a global tool, which might be used by a different project, we also should create a new ticket to clarify the situation improve the message.

In case, further manual testing is needed, this are the steps I used to simplify the testing:

  1. Navigate into the git repository with the correct branch
  2. Run mvn -q -pl cli -DskipTests compile dependency:build-classpath -Dmdep.outputFile=/tmp/ide-cp.txt
  3. Run java -cp "$(pwd)/cli/target/classes:$(cat /tmp/ide-cp.txt)" com.devonfw.tools.ide.cli.Ideasy pgadmin

@oanding-blrng

oanding-blrng commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Besides the needed modification of the CHANGELOG.adoc I found nothing in the code, which catch my eyes.

@oanding-blrng oanding-blrng moved this from Team Review to 👀 In review in IDEasy board Jul 6, 2026
@oanding-blrng

oanding-blrng commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

I searched in the codebase and found:

@Override
public void uninstall() {
//TODO: handle "uninstall <globaltool>"
LOG.error("Couldn't uninstall " + this.getName());
}

so uninstalling isn't just supported yet. There is also ticket #399.

Therefore this ticket can move on.

@shodiBoy1 shodiBoy1 moved this from 👀 In review to 🏗 In progress in IDEasy board Sep 3, 2026
@hohwille hohwille moved this from 🏗 In progress to Team Review in IDEasy board Sep 3, 2026
@shodiBoy1

Copy link
Copy Markdown
Contributor Author

Tested the latest changes from this PR on macOS ARM64 with pgAdmin 9.17.
Fresh download, DMG extraction, and installation to /Applications/pgAdmin 4.app all completed successfully. The original Permission denied error no longer occurs.

shohzodsobirov@MacBookPro macos-test % IDE_ROOT=/Users/shohzodsobirov/projects \ 
  /Users/shohzodsobirov/projects/macos-test/software/java/bin/java \
  -cp "$PGADMIN_PR_DIR/cli/target/classes:$(cat "$PGADMIN_PR_DIR/cli/target/pgadmin-test-classpath.txt")" \
  com.devonfw.tools.ide.cli.Ideasy pgadmin
No CVEs found for version 9.17 of tool pgadmin.
Trying to download pgadmin-9.17-mac-arm64.dmg.2 from https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v9.17/macos/pgadmin4-9.17-arm64.dmg
WARNING: A restricted method in java.lang.foreign.MemorySegment has been called
WARNING: java.lang.foreign.MemorySegment::reinterpret has been called by org.jline.terminal.impl.ffm.FfmTerminalProvider in an unnamed module (file:/Users/shohzodsobirov/.m2/repository/org/jline/jline/4.3.1/jline-4.3.1.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

Downloading 100% │███████████████████│ 222/222MiB (0:00:22 / 0:00:00) 10,1MiB/s
SHA-256 checksum c49fe899451596ffcf18dbf4c452c89bcec3082dbc31838d46b7dbda792d84df is correct.
Extracting DMG file /Users/shohzodsobirov/Library/Caches/IDEasy/downloads/default/pgadmin-9.17-mac-arm64.dmg to /Users/shohzodsobirov/projects/_ide/tmp/pgadmin
We need to run the following privileged command(s):
sudo /bin/mv /Users/shohzodsobirov/projects/_ide/tmp/pgadmin/pgAdmin 4.app /Applications/pgAdmin 4.app
This will require root permissions!
Password:
Installation process for pgadmin in version 9.17 has started
shohzodsobirov@MacBookPro macos-test % 

@laim2003

Copy link
Copy Markdown
Contributor

Hi, it might still take some time until I get this tested. My mac currently has some connectivity issues that I cant seem to get fix right now.

@shodiBoy1 shodiBoy1 changed the title fixed pgAdmin macOS dmg installation #798: fixed pgAdmin macOS dmg installation Sep 15, 2026

@laim2003 laim2003 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your PR! The download and etraction works. I just noticed one weird behaviour: When running pgadmin using the last command in the testing instructions, the terminal did not release after PG admin opened. This is where it stays after launching:

lukasfaber@MacBook-Air-von-Lukas test-fix % cd ~/projects/test-fix
  IDE_ROOT=~/projects java -cp "$HOME/projects/ideasy/workspaces/main/IDEasy/cli/target/classes:$(cat /tmp/ide-cp.txt)" com.devonfw.tools.ide.cli.Ideasy pgadmin
No CVEs found for version 9.17 of tool pgadmin.

This could be disruptive for users. Other then that, works perfectly👍🏻

@shodiBoy1

Copy link
Copy Markdown
Contributor Author

Hi, thanks for your PR! The download and etraction works. I just noticed one weird behaviour: When running pgadmin using the last command in the testing instructions, the terminal did not release after PG admin opened. This is where it stays after launching:

lukasfaber@MacBook-Air-von-Lukas test-fix % cd ~/projects/test-fix
  IDE_ROOT=~/projects java -cp "$HOME/projects/ideasy/workspaces/main/IDEasy/cli/target/classes:$(cat /tmp/ide-cp.txt)" com.devonfw.tools.ide.cli.Ideasy pgadmin
No CVEs found for version 9.17 of tool pgadmin.

This could be disruptive for users. Other then that, works perfectly👍🏻

Thanks for catching that, I fixed it and retested.

~/projects/macos-test %  IDE_ROOT=~/projects java -cp "$HOME/IdeaProjects/IDEasy/cli/target/classes:$(cat /tmp/ide-cp.txt)" com.devonfw.tools.ide.cli.Ideasy pgadmin
No CVEs found for version 9.17 of tool pgadmin.
~/projects/macos-test % 

@shodiBoy1 shodiBoy1 moved this from Team Review to 👀 In review in IDEasy board Sep 17, 2026
@laim2003
laim2003 requested a review from hohwille September 23, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS specific for Apple MacOS pgadmin postgres admin UI integration

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

pgadmin not working on Mac

6 participants