0
votes

I installed leiningen on fedora, I followed the instruction:

  1. download the script
  2. Paste the script(via command line) to ~/bin (PATH)
  3. Execute the script
  4. Run lein(I had to did it with sudo) to self-install

but every time I want to run the "lein" command, I have to do it with "sudo".

How can i fix this? or what can i do to fix this?

Note: I installed leiningen at /bin but when i cd ~/bin as the installation guide said i get and error about the folder(not exist).

1
If it's at /bin, that's a folder owned by root and it would make (some) sense that you have to have escalated privileges to run it. If it's at ~/bin, that should be in your own home folder. What does which lein tell you? - Makoto
@Makoto: I'd suggest type lein rather than which lein; the latter is an external command and doesn't know about shell aliases, functions, or the like, whereas the former is a builtin and has visibility into everything considered in the shell's execution process (including caching of prior PATH lookups, making it more accurate even for something known to be an external command). - Charles Duffy

1 Answers

6
votes

You installed it in /bin and ran it with sudo to install the lein jars initially, which means they are owned (and probably only readable) by root. You should install the script at ~/bin instead. You can fix it like this:

sudo rm /bin/lein
sudo rm ~/.lein
mkdir ~/bin
cd ~/bin
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
export PATH="${HOME}/bin:${PATH}"
lein

You should also add ${HOME}/bin to your $PATH. If you are using bash, add this to ~/.bashrc:

export PATH="${HOME}/bin:${PATH}"

You can do that using echo:

echo 'export PATH="${HOME}/bin:${PATH}"' >> ~/.bashrc