omf-sdk
omf-sdk copied to clipboard
Can't find installed candidates in fish
I have no idea if this could be related to omf-sdk, but I'm at a loss here. I can find candidates in zsh, but in fish sdkman is unaware of them. Same user.
The shell with syntax highlighting is fish:



I can't link candidates in fish either. It says "Invalid path" even though it's not malformed and sdk in zsh accepted it:

TL; DR: SDKMAN_DIR must be defined in bash. This is what my sdk.fish
does now:
bash -c "SDKMAN_DIR=$sdkman_prefix && source $sdkman_prefix/bin/sdkman-init.sh && sdk $argv"


@deather, would you be open to a PR with this change?
This comment gave me the clue. Since the bash omf-sdk starts (sdk.fish) is not a login shell, it doesn't run any of the profile scripts which would set SDKMAN_DIR
. It doesn't have any of the variables I set in fish either.
I don't really understand why sdkman behaves like this if SDKMAN_DIR
isn't set though, since what I have set is actually the default location, or why this solved the "Invalid path" problem.
Hi @gabrielfeo,
Thanks to take the time to post the bug. Normally that is the init.fish
which set the SDKMAN_DIR
automatically. The only thing that I see why this variable is not set, it is due to fenv
is missing.
- Can you check first if
fenv
is installed with this commandtype fenv
or checking if the folder.local/share/omf/pkg/
exists ? - Can you post the result of
env | grep SDK
in fish andbash -c "env" | grep SDK
?
We don't use the bash as login shell (-l option if I understood). I want to understand where is the problem before create the PR.
Thank you for your help. SDKMAN_DIR is indeed defined:



I have a lot to learn about shells. I'd appreciate it if you could confirm if I got this right.
-
SDKMAN_DIR
will get passed down tobash
because you export it -
fenv
makes sure when sdkman changes JAVA_HOME from withinbash
, the change gets passed up tofish
Back to the problem, I now have no clue as to why re-defining the variable solves the issue:

Your understanding is good about fenv, and export. If you read man set
you will find more information about the option. The trick you purposed is to define SDKMAN_DIR
for one session of bash.
The only thing we don't check is the .bash_profile
and the .bashrc
. Wen you use bash
it loads automatically some files like these two.
- Can you try
bash --norc --noprofile -c "source $sdkman_prefix/bin/sdkman-init.sh && sdk l java | grep '>>>'"
? - Can you paste the content of the
.bashrc
file ?
Here are the outputs of those commands. I don't have a .bashrc
. I do have a .bash_profile
, but it's probably irrelevant because it's not run in a non-login shell, according to this doc.

I just setup fish, omf and omf-sdk on another Mac to test this, and I had no issues. It's probably something local, maybe due to my home directory on this machine being in a non-standard location.
When you said your home directory is not standard, you have redefined it with these kind of command https://stackoverflow.com/a/26427748/1595433 ? or you just change the $HOME
variable ?
Can you give me the output of bash -c "echo $HOME"
, bash -c "echo ~"
and bash -c "ls -la ~ | grep .sdkman"
?
I moved my home directory using macOS's System Preferences:

