I just installed racer
using cargo
. After installing it say this:
Installing /home/karthik/.cargo/bin/racer
warning: be sure to add `/home/karthik/.cargo/bin` to your PATH to be able to run the installed binaries
How do I do this? Googling didn't help. Also, Should I be setting a PATH
variable for cargo bin as well?
Edit: OS is Ubuntu 14.04 and I have super user access
In command line mode you just have to type export PATH=$PATH:/home/karthik/.cargo/bin and hit Enter. Then type your command to run your program Ok, I've done that, now how do I set Racer's path? I've cloned rust's src code and set the Rust src path Ok, I have a new problem. For racer I did export PATH=$PATH:/home/karthik/.cargo/bin/racer.
As a regular user, you would be using Cargo for installing Rust based applications. As a programmer, you’ll need Cargo for getting other Rust packages or create your own. Since Cargo includes rustc, I would advise installing it so that all required packages are installed in one go.
Rustup will keep the sources in sync with the toolchain if you run rustup update. If you want to use racer with multiple release channels (Rust has 3 release channels: stable, beta and nightly ), you have to also download Rust source code for each release channel you install.
The nfor the rust src path I did export RUST_SRC_PATH=/usr/local/src/rust/src. This works and I can use racer (and it works in vim with YouCompleteMe). But it doesn't work in any other terminal instance and if I close the terminal I did it in, it still doesn't work anywhere
You have to add the cargo bin path to your PATH
variable and set the RUST_SRC_PATH
in .profile
or .bash_profile
.
Related unix.stackechange question
There are two steps:
(1) Add the Cargo bin to your PATH
variable. You can run $ whereis cargo
to find the bin path, and then do $ sudo -H gedit /etc/environment
where you can add that new path section to your current PATH
variable. You will need to save and close the file (and you can ignore the error message in the terminal during the saving portion) in order for it to take effect.
(2) Run $ rustup component add rust-src
to download the necessary Rust source files for you.
At this point Racer should work properly.
This is based on the answer here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With