Mastodon

Assuming you are a macOS user, managing your installed software with HomeBrew and using Fish as your shell of choice, these are the steps to allow you to use SDKMAN to manage your Java sdks for your projects

Install SDKMAN with Homebrew

SDKMAN has it’s own HomeBrew Tap which you can use to install the software.

brew tap SDKMAN/tap
brew install SDKMAN-cli

This will add the SDKMAN tap to your Homebrew configuration and then use it to install the SDKMAN CLI.

Install Fisher

If you do not already have it installed, you will need to install Fisher, this is a plug-in manager for the Fish shell.

Full installation instructions are available in the Readme on the Fisher project, but the crux of the installation is:

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher

Install SDKMAN for Fish extension

You will need to install the SDKMAN! for Fish extension. This extension makes command sdk from SDKMAN! usable from fish, including auto-completion. Also adds binaries from installed SDKs to the PATH.

fisher install reitzig/[email protected]

Configure it all

At this point all the moving parts are installed, but some configuration still needs to be done to tie it all together.

Find out where SDKMAN! has been installed

echo $(brew --prefix SDKMAN-cli)/libexec

In my case, this told me that SDKMAN was installed to /opt/homebrew/opt/SDKMAN-cli/libexec Keep a note of the result of that command as you will need it later.

You will need to configure the SDKMAN for Fish plugin to use SDKMAN from the custom location that Homebrew installed it into.

Create a configuration file for the SDKMAN plugin for fish.

touch ~/.config/fish/conf.d/config_sdk.fish

In that file, add the following command to tell the plugin where it can find SDKMAN

set -g __sdkman_custom_dir /opt/homebrew/opt/sdkman-cli/libexec

You should now have SDKMAN working and set up in the Fish shell.

Fire up a new shell so that you have a fresh instance of Fish with all of it’s plug-ins set up, and use the following command to see if SDKMAN is now working

sdk help