Skip to content

Instantly share code, notes, and snippets.

@masudcsesust04
Created January 22, 2018 12:32
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save masudcsesust04/3c8ba2390fcd49e61851e92ea19907e2 to your computer and use it in GitHub Desktop.
Save masudcsesust04/3c8ba2390fcd49e61851e92ea19907e2 to your computer and use it in GitHub Desktop.
Fix sdk command not found after installing SDKMAN

Fix sdk command not found after installing SDKMAN.

You need to install following packages before installing sdkman:

sudo apt-get install unzip
sudo apt-get install zip
sudo apt-get install sed

Uninstall skdman if you installed already:

$ tar zcvf ~/sdkman-backup_$(date +%F-%kh%M).tar.gz -C ~/ .sdkman
$ rm -rf ~/.sdkman

Then reinstalled sdkman:

$ curl -s "https://get.sdkman.io" | bash

Next, open a new terminal or enter:

$ source "$HOME/.sdkman/bin/sdkman-init.sh"

Lastly, run the following code snippet to ensure that installation succeeded:

$ sdk version
@tinxue10273
Copy link

thank you very much.

@KorDum
Copy link

KorDum commented Dec 21, 2019

Hmmm...

> source "$HOME/.sdkman/bin/sdkman-init.sh"
~/.sdkman/bin/sdkman-init.sh (line 48): 'case' builtin not inside of switch block
case "${SDKMAN_PLATFORM}" in
^
from sourcing file ~/.sdkman/bin/sdkman-init.sh
	called on standard input

@rafambbr
Copy link

rafambbr commented Feb 5, 2020

Just execute this line: works fine for me Ubuntu 19.04

echo 'source "$HOME/.sdkman/bin/sdkman-init.sh"' >> ~/.zshrc

@Kashif-Rabbani
Copy link

Thank you so much.

@sendimarvin
Copy link

Thanks very much. You helped me alot

@Abdelmalek-bouguerra
Copy link

thx <3

@ichi-nakashima
Copy link

thank you~ I solved♪

@chretienTimmamo
Copy link

Thanks, my problem has been solved !

@masudcsesust04
Copy link
Author

Thanks, my problem has been solved !

Welcome.

@hendisantika
Copy link

Thanks, my problem has been solved !

@masudcsesust04
Copy link
Author

Thanks, my problem has been solved !

Welcome, My pleasure.

@chrismalan
Copy link

chrismalan commented Oct 4, 2021

I just added /home/your-username/.sdkman/contrib/completion/bash/ to the PATH in my .bashrc. ran $source ~/.bashrc and everything worked. Oh, yes, I also made the sdk script file executable.

@kharmaodo
Copy link

Thanks you

@Johnnbass
Copy link

Thank you man!

@parekhbhargav25
Copy link

Thanks a lot. was looking for this solution all day. just didn't installed zip and sed.

@eduraices
Copy link

Hi, i'm trying to write following Dockerfile:
`
FROM openjdk:11

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN apt-get update
RUN yes | apt-get install \
zip
sed
maven
&& curl -s https://get.sdkman.io | bash

RUN chmod +x $HOME/.sdkman/bin/sdkman-init.sh

RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh"

RUN sdk install springboot
`

I would like that all installations were made in one step, but i got this error:

Enjoy!!! Removing intermediate container 6d2edaa51f3f ---> f646a3a923ab Step 5/7 : RUN chmod +x $HOME/.sdkman/bin/sdkman-init.sh ---> Running in b42041cf00f1 Removing intermediate container b42041cf00f1 ---> 79f0bccb7358 Step 6/7 : RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh" ---> Running in 570541e87782 Removing intermediate container 570541e87782 ---> bc27527e859c Step 7/7 : RUN sdk install springboot ---> Running in d6b46c4b21c2 /bin/sh: line 1: sdk: command not found The command '/bin/sh -c sdk install springboot' returned a non-zero code: 127

I've tried a lot of things, including a dot call to .bashrc, but nothing changes. However once I start a container 'sdk' command is available and works fine. Could you help me mates? Thanks a lot.

@soraisv2
Copy link

Thanks from 2022

@manuelwallrapp
Copy link

@eduraices

I had the same issue, to put the whole command into the same layer worked for me.

RUN curl -s "https://get.sdkman.io" | bash &&
chmod +x ~/.sdkman/bin/sdkman-init.sh &&
yes y | sdk install maven 3.8.6

@marcio-loiola
Copy link

Thank you!

@joelsonejr
Copy link

Has anyone received this error message:

error: Found argument '-n' which wasn't expected, or isn't valid in this context

USAGE:
fd [FLAGS/OPTIONS] [] [...]

For more information try --help
/home/jonpop/.sdkman/bin/sdkman-init.sh:162: command not found: __sdkman_echo_debug
/home/jonpop/.sdkman/bin/sdkman-init.sh:196: command not found: __sdkman_echo_debug

I'm using sdkman with zsh (oh-my-zsh + powerlevel10k)

@srpr0grammer
Copy link

srpr0grammer commented Mar 31, 2023

Thank you so much man !!!!

@JoabeValverde
Copy link

Thanks my friends :D

@giakhanhcoder
Copy link

thanks broo

@xiaoxinmiao
Copy link

thanks, my brother

@gustavo-p0
Copy link

Thank you so much!

@danrocsan
Copy link

Thanks!

@rafaelsouza-hotmart
Copy link

Thanks!

@Guilherme-Araujo-Dev
Copy link

Has anyone received this error message:

error: Found argument '-n' which wasn't expected, or isn't valid in this context

USAGE: fd [FLAGS/OPTIONS] [] [...]

For more information try --help /home/jonpop/.sdkman/bin/sdkman-init.sh:162: command not found: __sdkman_echo_debug /home/jonpop/.sdkman/bin/sdkman-init.sh:196: command not found: __sdkman_echo_debug

I'm using sdkman with zsh (oh-my-zsh + powerlevel10k)

Sometimes an alias or 'find be like' is causing conflict. This error happened to me and I had to remove this alias:

alias find="fdfind"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment