Cargo path setup for rust-racer

12,443

Solution 1

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

Solution 2

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.

Share:
12,443
KDN
Author by

KDN

C, Rust and Python

Updated on June 04, 2022

Comments

  • KDN
    KDN almost 2 years

    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