dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
680 stars 64 forks source link

Problems while installing and setting Path #305

Closed BeyazAbi89 closed 2 years ago

BeyazAbi89 commented 2 years ago

I am sorry if this is a total noob question but I'm fairly new to programming and Linux in general.

I want to install choosenim

The first installation didnt work so I read up and it seems that for it to work one has to download and set $PATH in the bash.rc file like so:

curl https://nim-lang.org/choosenim/init.sh -sSf | sh

echo "export PATH=$HOME/.nimble/bin:$PATH" >> ~/.bashrc

export PATH=$HOME/.nimble/bin:$PATH

This didnt work either. Kali simply doesnt recognise any nim nor chossenim command.

So I looked up and found this video, tried that but it didnt work either.

Can someone help me or tell me what I do wrong?

I am using Kali Linux v.2022.2 with newest updates.

dom96 commented 2 years ago

hey, don't be sorry about noob questions :)

Try:

echo $PATH

(To see what your PATH actually contains, you should see $HOME/.nimble/bin there)

Then you can see what's actually in $HOME/.nimble/bin: ls $HOME/.nimble/bin.

Feel free to paste the output from these commands so I can help. Would also be useful to see what the curl https://nim-lang.org/choosenim/init.sh -sSf | sh command output was.

BeyazAbi89 commented 2 years ago

Wow thank you so much for your speedy answer. :)

curl https://nim-lang.org/choosenim/init.sh -sSf | sh prompts following output:

choosenim-init: Downloading choosenim-0.8.4_linux_amd64
      Info: Version 1.6.6 already selected
choosenim-init: ChooseNim installed in /home/kali/.nimble/bin
choosenim-init: You must now ensure that the Nimble bin dir is in your PATH.
choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file.
choosenim-init:     export PATH=/home/kali/.nimble/bin:$PATH

When I input echo $PATH I'll get:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/lib/jvm/jdk1.8.0_202/jre/bin:/usr/lib/jvm/jdk1.7.0_80/bin:/usr/lib/jvm/jdk1.7.0_80/db/bin:/usr/lib/jvm/jdk1.7.0_80/jre/bin:/usr/lib/jvm/jdk-9.0.4/bin:/usr/lib/jvm/jdk-9.0.4/db/bin:/usr/lib/jvm/jdk-9.0.4/jre/bin

So apart from the JDK nimble seems nowhere to be found.

I opened the bash.rc file with sudo nano ~/.bashrc and added the export PATH=/home/kali/.nimble/bin:$PATH command into the file just to be sure. The end of the bash.rc file looks like the following:

export PATH=/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/li>
export PATH=/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/li>
export PATH=/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/li>
export PATH=/home/kali/.nimble/bin:/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1>
export PATH=/home/kali/.nimble/bin:/home/kali/.nimble/bin:/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_20>
export PATH=/home/kali/.nimble/bin:/home/kali/.nimble/bin:/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_20>
export PATH=/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/li>
export PATH=/home/kali/home/kali/.nimble/bin/n:/home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/>
export PATH="$PATH:/home/kali/.nimble/bin"
export PATH=/home/kali/.nimble/bin:$PATH

Still same result. I swear it has to do with the export command but I cant wrap my head around it.

dom96 commented 2 years ago

huh, why does your .bashrc file have so many lines with /home/kali/.nimble/bin at the start?

In any case. What happens when you run:

export PATH=/home/kali/.nimble/bin:$PATH
echo $PATH

You should see /home/kali/.nimble/bin being output in that case. But if not then there might be something very weird going on. If you do see it then you should then be able to execute choosenim.

If you then have export PATH=/home/kali/.nimble/bin:$PATH in your ~/.bashrc then it should also work (but the many lines you already have in there seem redundant, though they seem to add a lot of different things). You can verify by restarting your terminal. Another thing to verify is whether you're definitely using bash, you can do so with echo $0, for example on my machine:

echo $0
-bash
BeyazAbi89 commented 2 years ago

When I runexport PATH=/home/kali/.nimble/bin:$PATH echo $PATH together or seperately, export doesnt prompt anythin in retun. When I run echo $PATH I'll get the same results as above, namely: /home/kali/.nimble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/db/bin:/usr/lib/jvm/jdk1.8.0_202/jre/bin:/usr/lib/jvm/jdk1.7.0_80/bin:/usr/lib/jvm/jdk1.7.0_80/db/bin:/usr/lib/jvm/jdk1.7.0_80/jre/bin:/usr/lib/jvm/jdk-9.0.4/bin:/usr/lib/jvm/jdk-9.0.4/db/bin:/usr/lib/jvm/jdk-9.0.4/jre/bin

echo $0 returns /usr/bin/zsh .

But after putting in export PATH=/home/kali/.nimble/bin:$PATH choosenim works just fine.

I really dont know what I did differently. It SHOULDNT work but it does. Huh...

dom96 commented 2 years ago

When I run echo $PATH I'll get the same results as above, namely:

You don't get the same results, check what you pasted again, the .nimble is there at the start.

I really dont know what I did differently. It SHOULDNT work but it does. Huh...

Seems I was right to suspect you not using bash. You are using zsh (it's what echo $0 returned) so you actually need to add the export ... line to your .zshrc :)

dom96 commented 2 years ago

Did that resolve your issues? Reopen if not.